1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Abort reauth flows on config entry reload (#140931)

* Abort reauth flows on config entry reload

* Don't cancel reauth when reload is triggered by a reauth flow

* Revert "Don't cancel reauth when reload is triggered by a reauth flow"

This reverts commit f37c75621e.

* Don't fail in FlowManager._async_handle_step when the flow was aborted

* Update tplink config flow

* Add tests

* Don't allow create_entry from an aborted flow

* Add comment

* Adjust after merge with dev
This commit is contained in:
Erik Montnemery
2025-04-10 20:55:34 +02:00
committed by GitHub
parent 88428fc772
commit cf63175232
5 changed files with 62 additions and 21 deletions

View File

@@ -494,8 +494,11 @@ class FlowManager(abc.ABC, Generic[_FlowContextT, _FlowResultT, _HandlerT]):
)
if flow.flow_id not in self._progress:
# The flow was removed during the step
raise UnknownFlow
# The flow was removed during the step, raise UnknownFlow
# unless the result is an abort
if result["type"] != FlowResultType.ABORT:
raise UnknownFlow
return result
# Setup the flow handler's preview if needed
if result.get("preview") is not None:
@@ -547,7 +550,7 @@ class FlowManager(abc.ABC, Generic[_FlowContextT, _FlowResultT, _HandlerT]):
flow.cur_step = result
return result
# Abort and Success results both finish the flow
# Abort and Success results both finish the flow.
self._async_remove_flow_progress(flow.flow_id)
return result