Skip to content

Commit 725aedb

Browse files
committed
Add readme explaining how to opt-in to rehydration
1 parent b3d2589 commit 725aedb

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,41 @@ export default Ember.Route.extend({
399399
```
400400
And they still take advantage of caching in the `shoebox`. No more redundant AJAX for already acquired data. Installation details are available in the addon [README](https://github.com/appchance/ember-cached-shoe#ember-cached-shoe).
401401

402+
### Rehydration
403+
404+
What is Rehydration?
405+
406+
The rehydration feature means that the Glimmer VM can take a DOM tree
407+
created using Server Side Rendering (SSR) and use it as the starting
408+
point for the append pass.
409+
410+
See details here:
411+
412+
https://github.com/glimmerjs/glimmer-vm/commit/316805b9175e01698120b9566ec51c88d075026a
413+
414+
In order to utilize rehydration in Ember.js applications we need to ensure that
415+
both server side renderers (like fastboot) properly encode the DOM they send to
416+
the browser with the serialization format (introduced in the commit above) AND
417+
that the browser instantiated Ember.js application knows to use the rehydration
418+
builder to consume that DOM.
419+
420+
Rehydration is 100% opt-in, if you do not specify the environment flag your
421+
application will behave as it did before!
422+
423+
We can opt-in to the rehydration filter by setting the following environment
424+
flag:
425+
426+
```
427+
EXPERIMENTAL_RENDER_MODE_SERIALIZE=true
428+
```
429+
430+
This flag is read by Ember CLI Fastboot's dependency; fastboot to alert it to
431+
produce DOM with the glimmer-vm's serialization element builder. This addon
432+
(Ember CLI Fastboot) then uses a utility function from glimmer-vm that allows
433+
it to know whether or not the DOM it received in the browser side was generated
434+
by the serialization builder. If it was, it tells the Ember.js Application to
435+
use the rehydration builder and your application will be using rehydration.
436+
402437
## Build Hooks for FastBoot
403438

404439
### Disabling incompatible dependencies

0 commit comments

Comments
 (0)