From ac7dc0360352dc8c9bcc1538e6a1fb0e82b6640b Mon Sep 17 00:00:00 2001
From: epenet <6771947+epenet@users.noreply.github.com>
Date: Wed, 9 Oct 2024 17:09:24 +0200
Subject: [PATCH] Do not cache the reconfigure entry in holiday config flow
 (#128005)

---
 homeassistant/components/holiday/config_flow.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/homeassistant/components/holiday/config_flow.py b/homeassistant/components/holiday/config_flow.py
index 32b85b5a41d..0284ac5c876 100644
--- a/homeassistant/components/holiday/config_flow.py
+++ b/homeassistant/components/holiday/config_flow.py
@@ -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,
                     )
-- 
GitLab