ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
851 stars 159 forks source link

server side rendered page refreshing #897

Closed amiarSlimane closed 2 years ago

amiarSlimane commented 2 years ago

when using fast-boot the page is rendered in the server side, the ember app is loaded in background, after the ember app is finished loading, the page get refreshed , how to avoid this behavior, is this an issue of ember-fastboot ?

https://user-images.githubusercontent.com/24839094/175077357-d643aaf4-6ca4-4fe6-aff8-dba7cfe2e751.mp4

gabrielgrant commented 2 years ago

I think what you're seeing is the repaint that happens by default if "rehydration" is not enabled.

By default, fastboot renders a static version of your app, and sends that to the client so it has something to show while the browser-side app is booting. By default, once the client-side JS has all loaded, Ember basically renders the page as it normally would, and replaces the fastboot-rendered page content with the in-browser rendered content. The result is the flash you're seeing. "rehydration" means that Ember running in the browser reuses the server-rendered version of the page and makes that active, rather than replacing it completely once loaded. this is obviously a more complicated process, so support is still somewhat experimental (and thus not turned on by default). See more info about how to enable rehydration (and how it works) here: https://github.com/ember-fastboot/ember-cli-fastboot#rehydration

amiarSlimane commented 2 years ago

thank you gabrielgrant, enabling "rehydration" solved the issue .