Skip to content

fix(voyager): refetch Related Entities sub-graph when main graph re-renders#100

Merged
allmonday merged 1 commit into
masterfrom
fix/007-related-entities-refetch-on-toggle
Jul 3, 2026
Merged

fix(voyager): refetch Related Entities sub-graph when main graph re-renders#100
allmonday merged 1 commit into
masterfrom
fix/007-related-entities-refetch-on-toggle

Conversation

@allmonday

Copy link
Copy Markdown
Collaborator

Problem

The Related Entities sub-graph (spec 005) was not following display-option changes. Toggling any of:

…re-rendered the main ER diagram but left the sub-graph showing the previous config's edges. The Pure FK toggle made this most visible (missing edges are obvious), but the bug affected every display toggle since spec 005 introduced the sub-graph.

Root cause

  • vue-main.js::onGenerate only dispatches to renderErDiagram (main graph) — it never touches the sub-graph.
  • store.js::fetchRelatedEntities has a dedup guard (spec 005 FR-011, anti-rapid-click) that returns early when selectedSchema === schemaName and the previous dot still exists.
  • So any re-render of the main graph with a new config leaves the sub-graph stuck on stale data.

Fix

In renderErDiagram, after the main graph renders, if a sub-graph is currently open (selectedSchema non-empty and dot present):

  1. Clear selectedSchema to defeat the dedup guard.
  2. Call fetchRelatedEntities(openSubSchema)buildErDiagramSubgraphPayload already threads every display option (cluster display / brief / show methods / hide reverse / etc.) into the request body.

The sub-graph re-renders with the new config, matching the main graph.

Spec 005 FR-011's anti-rapid-click dedup is preserved — the guard still fires when the same entity is clicked twice in quick succession while no config has changed.

Test plan

  • Manual (no frontend test baseline):
    1. uv run uvicorn demo.enterprise_voyager.voyager_demo:app --port 8010
    2. Open ER diagram → double-click an entity with a back_populates relationship (e.g. Post↔User).
    3. Open the Related Entities tab in the sidebar.
    4. Toggle Hide Reverse Relationships.
    5. Confirm sub-graph re-renders with ONETOMANY reverse edges hidden, matching the main graph.
    6. Repeat for Brief Mode and Show Module Cluster to confirm the fix benefits all toggles.
  • Confirm rapid double-clicking the same entity still hits the dedup (no duplicate requests).

Regression risk

Low — single 12-line addition in renderErDiagram. No data-structure or contract changes. Spec 005 FR-011 dedup still active in the same scenarios as before.

🤖 Generated with Claude Code

…enders

The Related Entities sub-graph (spec 005) was not following display-option
changes — toggling Hide Reverse Relationships / brief mode / Better Cluster
Display / Show Methods / etc. re-rendered the main ER diagram but left the
sub-graph showing the previous config's edges. The Pure FK toggle (PR #99)
made the issue most visible because missing edges are obvious, but the bug
affected every display toggle since spec 005 introduced the sub-graph.

Root cause: `onGenerate` only dispatches to `renderErDiagram` (main graph);
it never touches the sub-graph. `fetchRelatedEntities` has a dedup guard
(spec 005 FR-011) that returns early when `selectedSchema === schemaName`
and the previous dot still exists, so any re-render of the main graph
with a new config leaves the sub-graph stuck on stale data.

Fix: in `renderErDiagram`, after the main graph renders, if a sub-graph is
currently open (`selectedSchema` non-empty and `dot` present), clear
`selectedSchema` to defeat the dedup guard and call `fetchRelatedEntities`
again with the same schema. This picks up the latest toggle state through
`buildErDiagramSubgraphPayload`, which already threads every display
option (cluster display / brief / show methods / hide reverse / etc.).

Spec 005 FR-011's anti-rapid-click dedup is preserved — the guard still
fires when the same entity is clicked twice in quick succession while no
config has changed.

Manual verification: open ER diagram → double-click an entity with a
`back_populates` relationship (e.g. Post↔User) → open Related Entities tab
→ toggle "Hide Reverse Relationships" → sub-graph now re-renders with
ONETOMANY reverse edges hidden, matching the main graph.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@allmonday allmonday merged commit 133116b into master Jul 3, 2026
5 checks passed
allmonday added a commit that referenced this pull request Jul 3, 2026
Version bump for PR #100 (Related Entities sub-graph now refetches when
the main ER diagram re-renders due to a display-option toggle change).
Updates CHANGELOG, pyproject.toml, uv.lock.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant