Skip to content

bug: Cross-layer navigation keeps stale container layout cache #539

Description

@computersniper

Summary

Cross-layer navigation can keep stale container layout state, causing the target layer graph to render incorrectly.

Affected paths in packages/dashboard/src/store.ts:

  • navigateToNodeInLayer
  • navigateToHistoryIndex
  • goBackNode

These paths can switch activeLayerId but do not clear:

  • containerLayoutCache
  • containerSizeMemory
  • expandedContainers
  • pendingFocusContainer

Reproduction

  1. Open a graph with containers in multiple layers.
  2. Enter layer A, for example Storefront.
  3. Expand a container, for example Cluster A.
  4. Use search result, history, breadcrumb, or back navigation to jump to a node in layer B, for example Checkout > renderCart.
  5. If layer B has a container with the same id, the graph may reuse layer A's cached child positions.

Actual behavior

The breadcrumb and side panel can show the target layer/node, but the main graph does not render the expected target-layer nodes.

In my repro, the UI showed Project > CHECKOUT and selected renderCart, but the main React Flow canvas did not show Checkout nodes such as renderCart, Cart Drawer UI, or Cart State Store.

Actual screenshot

Image

It shows Project > CHECKOUT and renderCart selected in the side panel, but the main graph does not show the expected Checkout nodes such as renderCart, Cart Drawer UI, or Cart State Store.

Expected behavior

When navigation switches to a different layer, container layout/cache state should be cleared and recomputed for that layer.

A correctly rendered Checkout layer should show Checkout's own nodes inside the expanded containers, for example Cart State Store, renderCart, Cart Drawer UI, or related Checkout functions.

Expected screenshot

Image

The graph may still contain empty space because of layout/zoom, but Checkout's own nodes should be visible in the canvas. For example, this fresh Checkout layout shows nodes such as Cart State Store and renderOperationsView.

Why this likely happens

drillIntoLayer, navigateToOverview, and filter/detail-level setters already clear container layout state. The three cross-layer navigation paths above also change activeLayerId, but keep the old container cache. Container ids can collide across layers, so the new layer may reuse stale child positions from the previous layer.

Impact

Visible UI rendering bug. No data corruption, but common navigation paths can make the graph look empty or incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions