Fix live-mode link navigation not selecting the target link

In live mode the DOM is rebuilt from the device when switching sheets,
creating new element objects. The pending link from the old tree could
not be found by identity in canvas_link_map. Re-resolve it by from/to
attributes after the rebuild so the selection matches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-12 22:15:48 +03:00
co-authored by Claude Opus 4.6
parent 7dea3d744f
commit 60c022828d
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
import configparser import configparser
import os import os
VERSION = "0.0.0.094" VERSION = "0.0.0.095"
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
DEFAULT_GRID_SIZE = 10 DEFAULT_GRID_SIZE = 10
DEFAULT_ADD_TIMESTAMP = True DEFAULT_ADD_TIMESTAMP = True
+12
View File
@@ -637,6 +637,18 @@ def on_tree_select(event):
except Exception: except Exception:
import traceback; traceback.print_exc() import traceback; traceback.print_exc()
# The DOM rebuild replaced every element object, so a pending link from the
# old tree can no longer be found by identity. Re-resolve it by from/to.
if pending_link is not None:
old_from = pending_link.get("from", "")
old_to = pending_link.get("to", "")
links_container = app_state.xml_root_element.find("links") if app_state.xml_root_element is not None else None
if links_container is not None:
for lnk in links_container:
if lnk.get("from") == old_from and lnk.get("to") == old_to:
pending_link = lnk
break
if element is not None: if element is not None:
components_to_render = [child for child in element if child.tag == "comp"] components_to_render = [child for child in element if child.tag == "comp"]
elif tree.exists(selected_id): elif tree.exists(selected_id):