Skip to content

The shell re-renders in place: no reload, no flash, no leaked listeners - #142

Merged
brettheap merged 1 commit into
mainfrom
change/render-in-place-r1
Aug 9, 2026
Merged

brettheap merged 1 commit into
mainfrom
change/render-in-place-r1

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

"yes, get rid of the flash too"

The five controls that change what's shown — repository jump, repository
selector, project selector, refresh, and clearing a drill-in — now call
render() instead of window.location.reload(). There is no navigation left
in app.js.

The hard part isn't re-rendering, it's unbinding

Several views bind document-level listeners (Escape closes the explorer, Escape
closes the workbench, the wheel's keyboard paging, fullscreen and settings
events) and observe layout with ResizeObserver. Re-mounting them without
teardown means the second Escape press runs two handlers, the third runs three,
and the leak grows with every switch — silently, until something fires twice.

One AbortController per render is the whole mechanism. Everything a render
binds outside its own root passes { signal }, and starting the next render
aborts the last, removing all of it at once. No view needs a destroy() or any
bookkeeping — it honours the signal it's handed. Observers hook the same
signal's abort to disconnect.

The settings gear stays bound once for the life of the page: it owns no
snapshot state, so a re-render must neither rebind nor unbind it.

Measuring it properly mattered

My first leak check counted calls to addEventListener and showed keydown
climbing 4 → 13 over three switches — which looked like the scoping had failed
completely. It was the measurement: an aborted listener is gone, but its
registration was still counted.

Counting live listeners — registrations whose signal hasn't aborted — shows
them flat across four switches:

start after 4 switches
keydown 4 4
click 1 1
fullscreenchange 1 1
settings-change 1 1
total registrations 7 27

Two listeners are deliberately unscoped: the settings gear's, bound once.

Verified in place, zero navigations

  • Project switch from the wheel → lands back on the wheel, navigations: 0.
  • Drill-in → "drilled in: 10 documents — 2 identities carried by all 5 visible
    repositories"
    ; clear → gone. navigations: 0.

Suites

2816 passed, 19 skipped, exit 0.

One unrelated flake appeared in a single run —
test_wire_accept_and_the_pending_edits_plane, a git-backed register-edit wire
test — and passed both in isolation and on a full re-run. Nothing in this
change touches that lane, but it's worth knowing it can flake.

Brett: "yes, get rid of the flash too."

The five controls that change what is shown — the repository jump, the
repository selector, the project selector, a refresh, and clearing a drill-in
— now call `render()` instead of `window.location.reload()`. There is no
navigation left in app.js.

THE HARD PART IS NOT RE-RENDERING, IT IS UNBINDING. Several views bind
document-level listeners (Escape closes the explorer, Escape closes the
workbench, the wheel's keyboard paging, fullscreen and settings events) and
observe layout with ResizeObservers. Re-mounting them without teardown means
the second Escape press runs two handlers, the third runs three, and the leak
grows with every switch a human makes — silently, until something fires twice.

ONE `AbortController` PER RENDER is the whole mechanism. Everything a render
binds outside its own root passes `{ signal }`, and starting the next render
aborts the last, which removes all of it at once. No view needs a `destroy()`
and none keeps bookkeeping; it honours the signal it is handed. Observers hook
the same signal's `abort` to disconnect.

The settings gear stays bound ONCE for the life of the page — it owns no
snapshot state, so a re-render must neither rebind nor unbind it.

MEASURING IT PROPERLY MATTERED. The first leak check counted calls to
`addEventListener` and showed keydown climbing 4 -> 13 over three switches,
which looked like a total failure of the scoping. It was the measurement:
an aborted listener is gone but its registration was still counted. Counting
LIVE listeners — registrations whose signal has not aborted — shows them flat
at keydown 4, click 1, fullscreenchange 1, settings 1 across four switches,
against 27 total registrations. Two listeners are deliberately unscoped: the
settings gear's, bound once.

Verified in place with zero navigations: the project switch (lands back on the
wheel), and the drill-in and its clear ("drilled in: 10 documents — 2
identities carried by all 5 visible repositories", then gone).

Suites 2816 passed (exit 0). One unrelated flake appeared in a single run —
`test_wire_accept_and_the_pending_edits_plane`, a git-backed register-edit
wire test — and passed both in isolation and on a full re-run; nothing in this
change touches that lane.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 9, 2026 15:22

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

@brettheap
brettheap merged commit fdecc1f into main Aug 9, 2026
1 check passed
@brettheap
brettheap deleted the change/render-in-place-r1 branch August 9, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ideation dashboard shell to re-render in place (instead of reloading the page) while preventing listener/observer leaks across re-mounts by scoping render-installed bindings to a per-render AbortController.

Changes:

  • Replaced remaining window.location.reload()-based flows with in-place render() calls in the dashboard shell.
  • Introduced a per-render AbortController scope and threaded { signal } through views that bind document-level listeners / long-lived observers.
  • Added tests and runbook documentation to pin “no reload” behavior and the render-scope teardown rule.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/ideation-dashboard/test_bullseye_widget.py Adds a regression test asserting no reloads and that document listeners / observers are render-scoped.
scripts/ideation_dashboard/web/app.js Adds per-render scope management and switches key controls to call render() instead of reloading.
scripts/ideation_dashboard/web/views/wheel.js Scopes document listeners and disconnects ResizeObserver on render abort.
scripts/ideation_dashboard/web/views/funnel.js Disconnects ResizeObserver on render abort.
scripts/ideation_dashboard/web/views/explorer.js Scopes the overlay’s document Escape handler to the render scope.
scripts/ideation_dashboard/web/views/staging-workbench.js Scopes the overlay’s document Escape handler to the render scope.
docs/ideation-dashboard-session-runbook.md Documents the new in-place re-render behavior and the “one AbortController per render” rule.
Suppressed comments (1)

scripts/ideation_dashboard/web/app.js:734

  • A render aborted by a subsequent render() call can still continue past await probeCapabilities() and mount overlays / mutate DOM. Add an early-return guard immediately after the await so stale renders stop before doing further work.
    // every view's existing capability check is the whole gating.
    const caps = composed ? readOnlyCaps(probedCaps) : probedCaps;
    const explorer = mountExplorer(explorerRoot, snapshot, {
      signal,
      onOpenFile: (entry, pane, tile) => {
        const sourceKey = sourceKeyFor(entry);
        return renderViewer(pane, {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 927 to 931
mountRepoSelector(document.getElementById("repopicker"), {
index, active, snapshot, caps, projects,
onSelect: (key) => { storeKey(key); window.location.reload(); },
onRefreshed: () => window.location.reload(),
onSelect: (key) => { storeKey(key); render(); },
onRefreshed: () => render(),
});
Comment on lines +623 to 627
async function render() {
const signal = nextRenderScope();
const status = document.getElementById("loadstatus");
try {
// The snapshot INDEX (add-dashboard-repo-selector): the roster the selector
brettheap pushed a commit that referenced this pull request Aug 25, 2026
…chives

xFactory PR #127 merged at e02d0a8 and that commit is an ancestor of the
aggregation's main, so the code surface this change declared has landed where
it was always going to land: two .gitmodules entries, two gitlinks at exactly
the validated commits 1aa184e and 05f4404, and the README submodule
documentation. The gate checked the merge sha for ancestry rather than
trusting a branch tip, which is the trap the title-uniqueness archive already
recorded once. Task 3.5 carries the read-back and the dated realization note
supersedes the 2026-08-21 snapshot that still said the act had not run.

The delta restates "Install repository scope" canon-complete: both promoted
scenarios byte-identical, the body carried verbatim and extended, and canon
was last amended 2026-07-13, so no later writer's amendment was overwritten by
a restatement that predated it. Promotion moved that requirement and nothing
else — 473 requirements across 50 capabilities before and after, none added,
none removed, one modified, and the promoted text is byte-for-byte the delta's.

All seven of the change's not-this-change boxes archive open, because each
names work the ratification refuses to authorize and ticking a refusal turns
it into a claim. One of them is now also a live observation: both pins have
advanced past the validated commits, which 5.7 permits by route rather than
forbids, and both advances took that route through aggregation PRs #135 and
#142. The item stays open as a standing boundary on every future advance.

Co-Authored-By: Claude Fable 5 <[email protected]>
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.

2 participants