mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Improve comments in ConfigEntriesFlowManager.async_finish_flow (#131175)
This commit is contained in:
parent
d8549409f7
commit
23acc31616
@ -1482,8 +1482,6 @@ class ConfigEntriesFlowManager(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Unload the entry before setting up the new one.
|
# Unload the entry before setting up the new one.
|
||||||
# We will remove it only after the other one is set up,
|
|
||||||
# so that device customizations are not getting lost.
|
|
||||||
if existing_entry is not None and existing_entry.state.recoverable:
|
if existing_entry is not None and existing_entry.state.recoverable:
|
||||||
await self.config_entries.async_unload(existing_entry.entry_id)
|
await self.config_entries.async_unload(existing_entry.entry_id)
|
||||||
|
|
||||||
@ -1506,12 +1504,14 @@ class ConfigEntriesFlowManager(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if existing_entry is not None:
|
if existing_entry is not None:
|
||||||
# Unload and remove the existing entry
|
# Unload and remove the existing entry, but don't clean up devices and
|
||||||
|
# entities until the new entry is added
|
||||||
await self.config_entries._async_remove(existing_entry.entry_id) # noqa: SLF001
|
await self.config_entries._async_remove(existing_entry.entry_id) # noqa: SLF001
|
||||||
await self.config_entries.async_add(entry)
|
await self.config_entries.async_add(entry)
|
||||||
|
|
||||||
if existing_entry is not None:
|
if existing_entry is not None:
|
||||||
# Clean up devices and entities belonging to the existing entry
|
# Clean up devices and entities belonging to the existing entry
|
||||||
|
# which are not present in the new entry
|
||||||
self.config_entries._async_clean_up(existing_entry) # noqa: SLF001
|
self.config_entries._async_clean_up(existing_entry) # noqa: SLF001
|
||||||
|
|
||||||
result["result"] = entry
|
result["result"] = entry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user