-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refactor rendering and transitions #10594
Conversation
|
I'm declaring bankruptcy on this branch, but will keep it around as a convenient reference. The ideas are sound, but it became too unwieldy to land. Going to try and reimplement it more incrementally. |
Track progress here
This is very WIP, and lots of tests are failing.
Right now, there's a lot of complexity around rendering and transitions that I'm very confident is unnecessary. For each thing like
{#if ...}
,{#each ...}
etc we have a correspondingblock
type, each with a different shape, and when we interact with the tree in some way we need to lots oftype === IF_BLOCK
checks and suchlike. Similarly, we have different kinds of transitions for different kinds of blocks.We don't need any of this — we just need the effect tree, and a single type of block:
Here, a 'block' is technically a 'managed render effect' — the terminology could probably be improved somewhat, since the consequent/alternate functions don't re-run autonomously. They're managed, but they're not effects. Nonetheless, they are part of the effect tree insofar as they contain effects and are contained by effects, so for now we'll gloss over it.
Transitions belong to their immediate block (i.e. to the consequent or the alternate rather than the
{#if ...}
, or the pending block rather than the{#await ...}
). This PR introduces the idea of pausing and resuming these blocks; the logic is shared betweenif
andeach
andawait
andkey
and everything else.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint