Hydrate on first load, not destroy

This commit is contained in:
Alex Berg
2018-01-19 01:22:08 -06:00
committed by GitHub
parent a6dc61a182
commit 5adfdd6fe0

View File

@@ -60,7 +60,7 @@ function render(Component: ComponentConstructor, data: any, scroll: ScrollPositi
component = new Component({ component = new Component({
target, target,
data, data,
hydrate: !!component hydrate: !component
}); });
if (scroll) { if (scroll) {
@@ -73,7 +73,7 @@ function prepare_route(Component: ComponentConstructor, data: RouteData) {
return { Component, data }; return { Component, data };
} }
if (!component && window.__SAPPER__ && window.__SAPPER__.preloaded) { if (!component && window.__SAComponentPPER__ && window.__SAPPER__.preloaded) {
return { Component, data: Object.assign(data, window.__SAPPER__.preloaded) }; return { Component, data: Object.assign(data, window.__SAPPER__.preloaded) };
} }
@@ -224,4 +224,4 @@ export function goto(href: string, opts = { replaceState: false }) {
} else { } else {
window.location.href = href; window.location.href = href;
} }
} }