Move morphing out of render phase #8
Labels
enhancement
New feature or request
feature: morphing
Related to element morphing
major
Breaking change
In preparation for error boundary support (#7), we need to ensure all internal mutation is moved out of the render call (i.e. no morphing a child element during render, including component boundaries).
Use a
@preact/signals
observer effect (hereon referred to as "the observer") to capture observed values during render (as we already do), but change what happens when a change is detected. Instead of rerendering synchronously, tear down the observer and schedule an update on the next microtask (in the future, we could do intelligent scheduling).Assign internal context (on the component scheduled to update) that tracks the root component in the case of multiple components being invalidated in the same microtask. Start by rerendering the root component, then rerender top-down any remaining scheduled components (as memoization may prevent the full update from the root). Any remaining components become root components of their own update.
While updating the components, collect any nodes that require morphing. Once all components have updated, morph them all at once.
The text was updated successfully, but these errors were encountered: