Do not cache the reconfigure entry in here travel time config flow (#128003)

This commit is contained in:
epenet 2024-10-09 17:12:46 +02:00 committed by GitHub
parent ac7dc03603
commit b38694fbcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,8 +103,6 @@ class HERETravelTimeConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
_entry: ConfigEntry
def __init__(self) -> None:
"""Init Config Flow."""
self._config: dict[str, Any] = {}
@ -144,9 +142,9 @@ class HERETravelTimeConfigFlow(ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration."""
self._entry = self._get_reconfigure_entry()
return self.async_show_form(
step_id="user", data_schema=get_user_step_schema(self._entry.data.copy())
step_id="user",
data_schema=get_user_step_schema(self._get_reconfigure_entry().data),
)
async def async_step_origin_menu(self, _: None = None) -> ConfigFlowResult:
@ -232,10 +230,9 @@ class HERETravelTimeConfigFlow(ConfigFlow, domain=DOMAIN):
self._config.pop(CONF_DESTINATION_ENTITY_ID, None)
if self.source == SOURCE_RECONFIGURE:
return self.async_update_reload_and_abort(
self._entry,
self._get_reconfigure_entry(),
title=self._config[CONF_NAME],
data=self._config,
reason="reconfigure_successful",
)
return self.async_create_entry(
title=self._config[CONF_NAME],
@ -277,7 +274,7 @@ class HERETravelTimeConfigFlow(ConfigFlow, domain=DOMAIN):
self._config.pop(CONF_DESTINATION_LONGITUDE, None)
if self.source == SOURCE_RECONFIGURE:
return self.async_update_reload_and_abort(
self._entry, data=self._config, reason="reconfigure_successful"
self._get_reconfigure_entry(), data=self._config
)
return self.async_create_entry(
title=self._config[CONF_NAME],