This is an automated email from the ASF dual-hosted git repository.

wu-sheng pushed a commit to branch fix/3d-fps-and-layer-rehydrate
in repository https://gitbox.apache.org/repos/asf/skywalking-horizon-ui.git

commit a527f0342a4203601336cab0df1a58f3dae9a6d3
Author: Wu Sheng <[email protected]>
AuthorDate: Sun May 31 08:25:13 2026 +0800

    fix(layer): rehydrate selection on same-layer deep links
    
    The shell watch keyed only on layerKey, so navigating to another URL on
    the SAME layer with different ?service/?instance/?endpoint never re-seeded
    the selection store (stale in-memory pick). Key the watch on the layer
    key plus the three seed params; guard so the post-seed param strip
    (params -> absent) does not re-seed and loop.
---
 apps/ui/src/layer/LayerShell.vue | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/apps/ui/src/layer/LayerShell.vue b/apps/ui/src/layer/LayerShell.vue
index 75b58d5..4247c59 100644
--- a/apps/ui/src/layer/LayerShell.vue
+++ b/apps/ui/src/layer/LayerShell.vue
@@ -80,16 +80,26 @@ const scopeSegment = computed<string>(() => {
 onBeforeUnmount(() => {
   selectionStore.clear();
 });
+// Re-seed the selection store on layer ENTRY and on any SAME-LAYER
+// navigation that arrives with fresh ?service/?instance/?endpoint (deep
+// links into the layer the operator is already on). Keyed on the layer
+// key plus the three seed params — but the strip below removes those
+// params right after seeding, and that removal (params → absent) must NOT
+// re-seed, so we only act when the layer changed OR seed params are
+// actually present.
 watch(
-  layerKey,
-  (key) => {
+  [layerKey, () => route.query.service, () => route.query.instance, () => 
route.query.endpoint],
+  ([key], prev) => {
     if (!key) return;
-    selectionStore.resetForLayer(key, route.query);
-    // After hydrating, strip the seed params so the address bar reads
-    // as a clean `/layer/<key>/<scope>` URL. The store now owns the
-    // live selection; the params were a one-shot seed.
     const q = route.query;
-    if (q.service != null || q.instance != null || q.endpoint != null) {
+    const hasSeed = q.service != null || q.instance != null || q.endpoint != 
null;
+    const layerChanged = key !== (prev?.[0] as string | undefined);
+    if (!layerChanged && !hasSeed) return;
+    selectionStore.resetForLayer(key, q);
+    // After hydrating, strip the seed params so the address bar reads as a
+    // clean `/layer/<key>/<scope>` URL. The store now owns the live
+    // selection; the params were a one-shot seed.
+    if (hasSeed) {
       const { service: _s, instance: _i, endpoint: _e, ...rest } = q;
       void _s; void _i; void _e;
       void router.replace({ path: route.path, query: rest });

Reply via email to