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

App shell redesign #177

Merged
merged 10 commits into from
Aug 19, 2022
Merged

App shell redesign #177

merged 10 commits into from
Aug 19, 2022

Conversation

arctic-hen7
Copy link
Member

This PR redesigns the way the Perseus app shell works, including adding full automatic support for proper hydration of initial loads. This increases the time-to-interactive of all Perseus apps by making it no longer dependent on a network request of any kind --- everything is now included in the initial HTML file the client gets (not including the JS and Wasm bundles, of course). This also reduces the amount of data that needs to be transferred over the network for subsequent loads, eliminates nearly all wrapper <div>s (making styling full-page layouts substantially easier), and substantially reduces the size of production Perseus bundles (files for subsequent loads are much lighter now).

In testing with a development bundle, the basic example achieved 99 Lighthouse scores on mobile, the highest ever, so, with a production bundle of less than a fifth of the size, Perseus' performance on both desktop and mobile should be even better than it is today!

Note: this PR resolves the difference between using the hydrate flag or not to almost nothing in terms of performance.

Fixes #173.

This improves performance substantially, especially on mobile and
bandwidth-restricted devices, since interactivity requires no external
network requests for fetching translations.
Also moved some internal functions into more sensible places now that
the app shell has been forked into subsequent/initial loads.
This doesn't work yet, because the router state is still in limbo.
This was possible if HSR took effect before interactivity.
@arctic-hen7
Copy link
Member Author

arctic-hen7 commented Aug 19, 2022

BREAKING CHANGES:

  • Added ErrorLoaded { path } case to RouterLoadState (which must now be matched)
  • Removed page_visible testing checkpoint (use page_interactive instead)
  • router_entry checkpoint is now only fired on subsequent loads

@arctic-hen7 arctic-hen7 marked this pull request as ready for review August 19, 2022 23:54
@arctic-hen7 arctic-hen7 merged commit d407727 into main Aug 19, 2022
@arctic-hen7 arctic-hen7 deleted the app-shell-redesign branch August 19, 2022 23:56
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.

Proper hydration in the app shell
1 participant