fix: guard openNodeDetail against a stale-response race (#97) by BorisTyshkevich · Pull Request #113 · Altinity/altinity-sql-browser · GitHub
Skip to content

fix: guard openNodeDetail against a stale-response race (#97)#113

Merged
BorisTyshkevich merged 1 commit into
mainfrom
fix/stale-detail-guard-97
Jul 1, 2026
Merged

fix: guard openNodeDetail against a stale-response race (#97)#113
BorisTyshkevich merged 1 commit into
mainfrom
fix/stale-detail-guard-97

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

What & why

The fullscreen schema graph's node detail pane had a stale-response race: click table A, then quickly click table B before A's ch.loadTableDetail fetch resolves, and if A resolves after B, A's openDetailPane call fires last and silently replaces B's already-mounted pane + selection ring with A's stale data — last-resolved wins instead of last-clicked. Filed as #97 during #85's review; predates that PR.

openNodeDetail now stashes the clicked node as a per-overlay-document token (keyed by the same document resolution openDetailPane uses) before kicking off the fetch, and checks it's still current before the final mount — a superseded fetch's result is dropped.

Verification

  • Unit test added (tests/unit/app.test.js) deterministically forcing the out-of-order resolution via a manually-controlled promise.
  • Live-verified in a real Chromium browser with a throwaway createApp fixture (per-repo pattern, deleted after use): reproduced the exact race — reverting just the app.js fix made the test fail (pane reverted to the stale lin.events), confirming both that the test discriminates and that the fix holds.
  • npm run test:e2e (Chromium/Firefox/WebKit): Chromium + WebKit clean; 13 Firefox beforeEach timeouts reproduced identically on unmodified main in this sandbox (pre-existing environment flakiness, unrelated to this change).

Checklist

  • npm test passes (the per-file coverage gate is non-negotiable)
  • Tests added/updated in the same change as the code
  • npm run build succeeds (single-file dist/sql.html)
  • Layers kept honest: pure logic in src/core/, network in src/net/ (injected fetch), DOM in src/ui/
  • No new runtime dependency
  • CHANGELOG.md ([Unreleased]) updated
  • Reconciled affected tracked work — n/a: standalone inbox item, not tracked in roadmap Roadmap to 1.0.0 #68 or an ADR

Closes #97

🤖 Generated with Claude Code

https://claude.ai/code/session_01784dKCpk5W7rdpUAwcQnix

Clicking table A in the fullscreen schema graph then quickly clicking
table B before A's fetch resolved let A's slower response land last and
silently replace B's already-mounted detail pane + selection ring —
last-resolved-wins instead of last-clicked-wins. openNodeDetail now
tracks the most recently requested node per overlay document and drops
a fetch whose click has since been superseded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01784dKCpk5W7rdpUAwcQnix
@BorisTyshkevich BorisTyshkevich merged commit c56745f into main Jul 1, 2026
6 checks passed
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.

inbox: openNodeDetail/openDetailPane has no stale-response guard

1 participant