mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Do not cache the reconfigure entry in holiday config flow (#128005)
This commit is contained in:
parent
253a5e3e4b
commit
ac7dc03603
@ -8,7 +8,7 @@ from babel import Locale, UnknownLocaleError
|
||||
from holidays import list_supported_countries
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
from homeassistant.const import CONF_COUNTRY
|
||||
from homeassistant.helpers.selector import (
|
||||
CountrySelector,
|
||||
@ -27,7 +27,6 @@ class HolidayConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for Holiday."""
|
||||
|
||||
VERSION = 1
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the config flow."""
|
||||
@ -115,15 +114,15 @@ class HolidayConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle the re-configuration of a province."""
|
||||
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 the re-configuration of a province."""
|
||||
reconfigure_entry = self._get_reconfigure_entry()
|
||||
if user_input is not None:
|
||||
combined_input: dict[str, Any] = {**self.config_entry.data, **user_input}
|
||||
combined_input: dict[str, Any] = {**reconfigure_entry.data, **user_input}
|
||||
|
||||
country = combined_input[CONF_COUNTRY]
|
||||
province = combined_input.get(CONF_PROVINCE)
|
||||
@ -145,10 +144,7 @@ class HolidayConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
name = f"{locale.territories[country]}{province_str}"
|
||||
|
||||
return self.async_update_reload_and_abort(
|
||||
self.config_entry,
|
||||
title=name,
|
||||
data=combined_input,
|
||||
reason="reconfigure_successful",
|
||||
reconfigure_entry, title=name, data=combined_input
|
||||
)
|
||||
|
||||
province_schema = vol.Schema(
|
||||
@ -156,7 +152,7 @@ class HolidayConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
vol.Optional(CONF_PROVINCE): SelectSelector(
|
||||
SelectSelectorConfig(
|
||||
options=SUPPORTED_COUNTRIES[
|
||||
self.config_entry.data[CONF_COUNTRY]
|
||||
reconfigure_entry.data[CONF_COUNTRY]
|
||||
],
|
||||
mode=SelectSelectorMode.DROPDOWN,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user