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