use nextTick

This commit is contained in:
Rich Harris
2019-01-30 13:35:50 -05:00
parent e4319bee0e
commit 83f7102f6b

View File

@@ -1,3 +1,4 @@
import { nextTick } from 'svelte';
import RootComponent, * as RootComponentStatic from '__ROOT__';
import ErrorComponent from '__ERROR__';
import {
@@ -161,10 +162,12 @@ function render(props: any, nullable_depth: number, scroll: ScrollPosition, nosc
level.component = null;
root_component.$set({ child: props.child });
// then render new stuff
// TODO do we need to call `flush` before doing this?
level.component = component;
root_component.$set(props);
nextTick(() => {
// then render new stuff
// TODO do we need to call `flush` before doing this?
level.component = component;
root_component.$set(props);
});
} else {
// first load — remove SSR'd <head> contents
const start = document.querySelector('#sapper-head-start');