Skip to content

Keep callback renders working after repeated updates - #165

Open
Seigiard wants to merge 1 commit into
WebReflection:mainfrom
Seigiard:fix/repeated-callback-render
Open

Seigiard wants to merge 1 commit into
WebReflection:mainfrom
Seigiard:fix/repeated-callback-render

Conversation

@Seigiard

@Seigiard Seigiard commented Oct 6, 2026

Copy link
Copy Markdown

For non-engineers.

  • Problem: A page could stop refreshing after two updates.
  • Impact: New data could arrive while users still saw the old list or text until they reloaded the page.
  • What was done: Repeated updates now keep the rendering state that owns the displayed content.
  • What you will notice: New list entries and text updates appear without a page reload.

Why

Fix the third and subsequent render(container, callback) calls for an unchanged template so repeated updates remain usable.

Watch out for

Door: two-way. A plain revert restores the broken repeated-render path; this change has no persistent data effects.

  • The browser regression follows the existing HTML tests and must be opened against rebuilt bundles; the current Node test command does not run browser tests.

Shape of the change

The second render updates the initialized cached Hole, but previously stored the fresh callback result instead; the third render then interpreted raw values as prepared update entries.

-    else known[1].update(hole);
+    else {
+      known[1].update(hole);
+      hole = known[1];
+    }
     rendered.set(where, [scope, hole]);

test/render.html checks four text renders, a list changing from empty to restored to prepended entries, and DOM node identity. Serve the repository root and open /test/render.html for the development bundle or /test/render.html?prod for production.

Evidence

  • Before: The browser regression failed in headless Chromium against both unpatched bundles on the third text render: Cannot assign to read only property '2' of string 'second'. In a desktop WebKit application, the list update failed with Node.insertBefore receiving a non-Node value.
  • After: Both rebuilt bundles report PASS: repeated text and list renders for the same browser regression.
  • Visuals: Behavioural DOM assertions are the evidence; no separate screenshots.

npm run test:all and npm run types pass. Development and production bundles were rebuilt with Rollup and tested in Chromium. CI has not run for this branch yet.

Keep the initialized Hole in the render cache after updating it. Previously,
the second callback render cached a fresh, uninitialized Hole, so the third
render could throw and leave the DOM stale.

Add a browser regression for repeated text and list updates, including DOM
node reuse. Verify it against both development and production bundles.

This branch has not been deployed

No deployments
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