-
Notifications
You must be signed in to change notification settings - Fork 535
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
Use SSR-compatible slot implementation in PageLayout #3036
Conversation
🦋 Changeset detectedLatest commit: 5dcc159 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 🔥 Just left some comments for some ideas while going through the code, feel free to ignore if they're not helpful 👍
Hi! Just leaving it here in case we need it: In case this change isn't backward compatible with instances of PageLayout in gh/gh, we can unblock this team by putting this in drafts/experimental first. |
Problem
PageLayout.Header
andPageLayout.Footer
don't render server-side because PageLayout uses an SSR-incompatible approach to implement its slots API (issue).Screen.Recording.2023-03-14.at.2.58.43.PM.mov
Notice that the layout shifts because the header appears after the page loads.
Slack discussion for context
Solution
This PR updates PageLayout to use an SSR-compatible slots implementation.
Tradeoff
In this new implementation,
PageLayout.Header
andPageLayout.Footer
must be direct children ofPageLayout
. This feels like a reasonable tradeoff becausePageLayout.Header
andPageLayout.Footer
aren't used often, and when they are used, they're almost always a direct child ofPageLayout
.PageLayout.Header
in 3 places. In 2 of 3 usages,PageLayout.Header
is a direct child ofPageLayout
. In the 3rd case,PageLayout.Header
can easily be refactored to be direct child ofPageLayout
.PageLayout.Footer
.Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.