Do not cache the reconfigure entry in feedreader config flow (#127989)

pull/128038/head
epenet 2024-10-09 17:32:08 +02:00 committed by GitHub
parent e8bc07d40f
commit ff1ea46c46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 6 deletions

View File

@ -42,7 +42,6 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow."""
VERSION = 1
_config_entry: ConfigEntry
_max_entries: int | None = None
@staticmethod
@ -124,17 +123,17 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
self._config_entry = self._get_reconfigure_entry()
return await self.async_step_reconfigure_confirm()
async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
reconfigure_entry = self._get_reconfigure_entry()
if not user_input:
return self.show_user_form(
user_input={**self._config_entry.data},
description_placeholders={"name": self._config_entry.title},
user_input={**reconfigure_entry.data},
description_placeholders={"name": reconfigure_entry.title},
step_id="reconfigure_confirm",
)
@ -145,12 +144,12 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
if isinstance(feed.bozo_exception, urllib.error.URLError):
return self.show_user_form(
user_input=user_input,
description_placeholders={"name": self._config_entry.title},
description_placeholders={"name": reconfigure_entry.title},
step_id="reconfigure_confirm",
errors={"base": "url_error"},
)
self.hass.config_entries.async_update_entry(self._config_entry, data=user_input)
self.hass.config_entries.async_update_entry(reconfigure_entry, data=user_input)
return self.async_abort(reason="reconfigure_successful")