Suspense: Active → Suspended → Resolved with fallback (M1-T15, closes #23) - #103
Merged
Conversation
- Value::Pending sentinel + useResource(key) -> (Pending|value, resolver):
a real state-driven suspension source (no timers/fakes)
- ReactNode::Suspense from <Suspense fallback={...}>; Text arm turns a
Pending read into RenderedNode::Suspended
- Suspense arm scans RECURSIVELY (a Pending text inside a host child
suspends; direct-children only missed it) and swaps the subtree for
the fallback
- Resolve -> one SetProp + SetText (zero Remove/Create - the swap is a
branch, not a tree rewrite); resolved state sticks across unrelated
re-renders; per-instance boundaries independent
- FIX: use_pending always returned Pending (resolve was a no-op); now
returns the stored slot value
4 tests in tests/suspense.rs; suite 149 green; clippy/fmt/audit clean.
Records: M1 15/18 in progress, 51/106.
Closes#23Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
What
Closes#23. The Suspense lifecycle with a real (not faked) pending source:
Value::Pending+useResource(key): a state-driven source — reads arePendinguntil the resolver Setter fires (dirty → flush → re-render). No timers or fakes.ReactNode::Suspense: the Text arm turns a Pending read into aRenderedNode::Suspendedmarker; the Suspense arm scans recursively (a Pending text inside a host child must suspend — direct-children-only missed it) and swaps the subtree for the fallback.use_pendingalways returnedPending, so resolve was a no-op; it now returns the stored slot value.Verification
4 tests in
tests/suspense.rs: fallback→resolve with minimal patches, siblings render while suspended, per-instance independence, unresolved stays suspended across unrelated re-renders. Suite 149 green; clippy-D warningsclean; fmt clean; audit green. Records: M1 15/18, overall 51/106.