Repository navigation
fix: schedule re-render when setState is called before component mount - #77
Merged
Merged
Conversation
When a child component fires an observeFieldScoped callback synchronously during the parent's renderElement (e.g. a cache-hit result field is already set when the observation is registered), setState is called on the parent before setComponentMounted has run. enqueueStateUpdate correctly stored the partial state in _pendingPartialStates but returned early before scheduling a re-render timer, so the component never re-rendered after mount. Fix: track whether there were any pending states in setComponentMounted and, if so, schedule a setTimeoutCore(0) re-render — matching the behaviour that enqueueStateUpdate would have produced had the component already been mounted. Also adds two regression tests and expands the renderer.md documentation to describe the observeFieldScoped synchronous-callback platform behaviour that triggers this edge case.
bchelkowski
requested review from
praveenKumarCH534 and
tbazelczuk
and removed request for
a team
April 8, 2026 10:28
github-actions Bot
pushed a commit
that referenced
this pull request
Apr 8, 2026
## [3.4.1](v3.4.0...v3.4.1) (2026-04-08) ### Bug Fixes * schedule re-render when setState is called before component mount ([#77](#77)) ([6aa25ee](6aa25ee))
|
🎉 This PR is included in version 3.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
When a child component fires an observeFieldScoped callback synchronously during the parent's renderElement (e.g. a cache-hit result field is already set when the observation is registered), setState is called on the parent before setComponentMounted has run. enqueueStateUpdate correctly stored the partial state in _pendingPartialStates but returned early before scheduling a re-render timer, so the component never re-rendered after mount.
Fix: track whether there were any pending states in setComponentMounted and, if so, schedule a setTimeoutCore(0) re-render — matching the behaviour that enqueueStateUpdate would have produced had the component already been mounted.
Also adds two regression tests and expands the renderer.md documentation to describe the observeFieldScoped synchronous-callback platform behaviour that triggers this edge case.