Shared node changes rebuild the flows whose published copy uses them, not their drafts

This commit is contained in:
2026-10-14 23:34:47 +02:00
parent ef9d9824bb
commit b345587ab9
3 changed files with 35 additions and 4 deletions
+2 -1
View File
@@ -837,7 +837,8 @@ class FlowController:
async def reload_lib_users(self, ref: str) -> list[str]:
"""Rebuild the flows running a shared node whose source has changed."""
flows = sorted({usage.split(".", 1)[0] for usage in self.store.usages(ref)})
usages = self.store.usages(ref, draft=False)
flows = sorted({usage.split(".", 1)[0] for usage in usages})
for flow in flows:
await self.reload_flow(flow)
return flows
+7 -3
View File
@@ -355,12 +355,16 @@ class FlowStore:
self._set_source_ref(flow, node_id, None)
self._commit(f"Unshare node '{flow}.{node_id}'")
def usages(self, lib_name: str) -> list[str]:
"""Every ``flow.node`` pointing at this shared source."""
def usages(self, lib_name: str, draft: bool = True) -> list[str]:
"""Every ``flow.node`` pointing at this shared source.
Read from the drafts the editor shows, or with ``draft`` off from the
published flows the engine runs.
"""
used = []
for name in self.list_flows():
try:
definition = self.read_flow(name, draft=True)
definition = self.read_flow(name, draft=draft)
except FlowNotFound:
continue
used += [