Skip to content
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

feat: SSR support #637

Merged
merged 2 commits into from
May 17, 2024
Merged

feat: SSR support #637

merged 2 commits into from
May 17, 2024

Conversation

tomas-c
Copy link
Contributor

@tomas-c tomas-c commented May 15, 2024

Before these changes, the Frame and Element components delayed rendering user components until after the first render due to their reliance on useEffect. This meant that (a) server-side rendering did not work (b) pages with many deeply nested components took many render iterations to fully render a page which on slower devices would cause a visible layout shift.

After these changes neither Element nor Frame rely on useEffect.

Resolves:

Before these changes, the Frame and Element components delayed rendering
user components until after the first render due to their reliance on
useEffect. This meant that (a) server-side rendering did not work (b)
pages with many deeply nested components took many render interations to
fully render a page which on slower devices would cause a visible layout
shift.

After this change, Element no longer relies on useEffect and Frame, no
longer relies on useEffect if initialData is provided.
@tomas-c tomas-c requested a review from prevwong as a code owner May 15, 2024 16:12
Copy link

changeset-bot bot commented May 15, 2024

🦋 Changeset detected

Latest commit: e4c6692

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@craftjs/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
craftjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 5:28pm

Copy link
Contributor Author

@tomas-c tomas-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included explanations for the changes in this self-review.

packages/core/src/nodes/Element.tsx Show resolved Hide resolved
packages/core/src/render/Frame.tsx Outdated Show resolved Hide resolved
@hugominas
Copy link

@tomas-c great work, this is such a needed feature @prevwong would be great to have your eyes on this PR

@prevwong prevwong changed the title feature: SSR support feat: SSR support May 16, 2024
Copy link
Owner

@prevwong prevwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just left a suggestion

packages/core/src/render/Frame.tsx Outdated Show resolved Hide resolved
Copy link
Owner

@prevwong prevwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 💯

@prevwong prevwong merged commit d26eefc into prevwong:main May 17, 2024
3 checks passed
@github-actions github-actions bot mentioned this pull request May 17, 2024
prevwong pushed a commit that referenced this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants