-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Raf aligned dom updates * Test approach leveraging our existing options.debounceRendering This all works fine, however it creates a discrepancy between browser usage and test usage which we want to avoid. The discrepancy is made clear in the failing tests. What we want to happen is for Preact to be first allowed to perform its render cycle, the effects that follow and only then should we clean up stragglers by performing the direct DOM updates. Currently what happens is that the ordering is "random" based on how the signals were registered. * options.requestAnimationFrame solves it * Improve changelog post Co-authored-by: Ryan Christian <[email protected]> * Update .changeset/ninety-beans-compare.md * Skip changing the SignalValue notifier when it's an object (JSX) --------- Co-authored-by: Ryan Christian <[email protected]>
- Loading branch information
1 parent
5b6d891
commit fea3e8d
Showing
3 changed files
with
100 additions
and
87 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
"@preact/signals": major | ||
--- | ||
|
||
Defer all DOM updates by an animation frame, this should make it so | ||
that any previously synchronous DOM update will be instead delayed by an | ||
animation frame. This allows Preact to first perform its own render | ||
cycle and then our direct DOM updates to occur. These will now | ||
be performed in a batched way which is more performant as the browser | ||
is prepared to handle these during the animation frame. | ||
|
||
This does impact how Preact based signals are tested, when | ||
you perform a signal update, you'll need to wrap it in `act`. In a way | ||
this was always the case, as a signal update that resulted in | ||
a Preact state update would require it to be wrapped in `act`, but | ||
now this is the norm. |
This file contains 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
This file contains 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