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

Partial Hydration based SSR media queries #36

Open
theKashey opened this issue May 23, 2020 · 1 comment
Open

Partial Hydration based SSR media queries #36

theKashey opened this issue May 23, 2020 · 1 comment
Assignees

Comments

@theKashey
Copy link
Collaborator

It's possible to render a "predicted" target during SSR, but the guess might be incorrect.
In order to "fix" we have to render everything twice:

  • first with predicted target, to match SSRed markup
  • next with the real target, where some pieces of Application could be rendered a bit differently. And that has a cost.

Proposal

  • MediaMatches might partial hydrate their children, in order to keep existing HTML if targets do not match, and update with a proper markup later.
  • that would reduce the amount of work React has to do.
  • MediaServerRender can do it automatically for a whole application as well.

Should be safe due to a top-level matches provider, which can orchestrate everything below it.

Alternatively

  • expose "couldUseHydration" function, which will propose to use render in case of hydration will lead to a double rendering. It's way faster to drop HTML and render ReactComponent, than to hydrate twice.
@theKashey theKashey self-assigned this May 23, 2020
@thearnica
Copy link
Owner

Don't forget about #11 - almost the same (but the opposite). #36 and #11 could play very nicely together.

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

No branches or pull requests

2 participants