fix(nanoviews): render the branch brought back by a write to the condition - #201
Closed
dangreen wants to merge 1 commit into
Closed
fix(nanoviews): render the branch brought back by a write to the condition#201dangreen wants to merge 1 commit into
dangreen wants to merge 1 commit into
Conversation
…ition A branch that writes its own condition - from a binding it started, or from its render body - used to leave the block showing content that was already contradicted: the swap it should have caused ran into a swapper that could not be re-entered, and the corrective branch was rendered but never started. Starting a swapped-in scope is no longer the renderer's move: the swap starts what it returns, so a correction lands on the swap's own stack. `decide` also carries a second, idle subscriber on the condition, whose read settles it and re-queues the parked swapper.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #201 +/- ##
=======================================
Coverage 84.99% 85.00%
=======================================
Files 140 140
Lines 3159 3160 +1
Branches 596 596
=======================================
+ Hits 2685 2686 +1
Misses 338 338
Partials 136 136 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A branch is allowed to disagree with the condition that selected it. A form that refuses to open until something is allowed, a row that normalises the value it was handed — the write goes back into the very signal the block swaps on, and the block has to end up showing the branch the write asks for.
It did not. The block showed the contradicted branch, and worse: the corrective branch was rendered but never started, so its DOM was in place while its effects never ran and never would.
Before:
<b>open</b>. The write to$openlanded while the swapper that reads$openwas running, and a running effect cannot be re-queued by its own propagation, so the swap that would undo it never happened.Two halves
Starting a scope is not the renderer's move.
deferScopeBindContextrendered the new content and started it. Now it only renders, and the swap starts what its callback returns:Before the mount walk the scope's anchor is still lazy and the start is a no-op, so the walk keeps the block's position among its siblings exactly as before. After it, the swapped-in content comes up on the swap's own stack — which is what leaves no scope behind that is rendered but never started.
The echo. That alone settles a write made from the branch's render body, but not one made from a binding the branch started: at that moment the swapper is parked, and nothing re-reads the condition.
decidenow carries a second subscriber that does nothing but read it:It is idle when the branch writes, so it is free to be notified, and its read settles the condition and re-queues the parked swapper for the corrective swap.
Tests
Three in
if.spec.ts, and they check the branch is live, not merely rendered — each asserts an effect of the brought-back branch, which only runs if that branch was started:for_goes through the same swapper and its whole suite is unchanged; no size pin moves anywhere in the chain.