feat: emit enterFrom classes from SSR when intro is set#37
Merged
Conversation
SSR/SSG previously rendered intro-animated content in its final visual state. Then hydration would apply the enterFrom classes and transition — but between the browser's first paint and hydration starting, users saw a flash of the final state. Now the SSR ControlCtx reads AnimationConfigCtx and, when intro: true is set, emits the enterFrom classes on each rendered slot element via the renderer's toggleClass primitive. The browser paints the pre-animation state directly, then hydration's runEnterAnimation removes enterFrom and transitions to the final state — same lifecycle as client-side, no flash. Applies to each (per-item) and single-slot controls (when, match, etc). Ordinary non-intro SSR output continues to render the final state directly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Deploying effex with
|
| Latest commit: |
65c74ec
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ce1cfc68.effex.pages.dev |
| Branch Preview URL: | https://feat-ssr-emit-enter-from.effex.pages.dev |
Deploying effex-api with
|
| Latest commit: |
65c74ec
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0654de3a.effex-api.pages.dev |
| Branch Preview URL: | https://feat-ssr-emit-enter-from.effex-api.pages.dev |
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.
Summary
Fix the FOUC on `intro: true`. Previously:
The flash between steps 2 and 3 is the FOUC.
Now:
Same lifecycle as pure client-side rendering, no flash.
Plumbing
Test plan
Note on user CSS
For this to give the expected visual result, users need the animation's transition to be set up in CSS. The recommended pattern (which the JSDoc examples use) is:
```ts
animate: {
enterFrom: "opacity-0 translate-y-4",
enter: "opacity-100 translate-y-0 transition duration-300",
}
```
The `transition` on `enter` is what makes the class-swap animate rather than snap.
🤖 Generated with Claude Code