Description
Motivation
Flashing page elements on wasm file load on prerendered pages.
How to reproduce
Try to open kavik.cz/about/ on a mobile or in a desktop browser with enabled throttling in dev tools. The first you see prerendered html and once the wasm is loaded, the entire page is rerendered which causes flashes.
Problem
This code: https://github.com/MartinKavik/kavik.cz/blob/master/crate/src/app.rs#L49. I have to delete root element content before render, otherwise Seed will append identical html at the end of the root.
How to resolve
Use prerendered HTML as the previously rendered HTML by Seed. So either introduce a new function hydrate
or make render
more intelligent (probably better option). There are examples from other frameworks: https://github.com/stereobooster/react-snap#basic-usage-with-create-react-app.
Possible implementation problems
Prerendered and rendered code isn't 100% identical, e.g. hamburger is spinner in prerendered version (see my example in section how to reproduce
).
Public API changes.
None, if we update render
function.