fix hydration

pull/1864/head
Rich Harris 7 years ago
parent e0faadbf26
commit 2f7bce4daf

@ -2,6 +2,7 @@ import { after_render, flush, intro, schedule_update } from './scheduler.js';
import { set_current_component } from './lifecycle.js'
import { is_function, run, run_all, noop } from './utils.js';
import { blankObject } from './utils.js';
import { children } from './dom.js';
export class $$Component {
constructor(options) {
@ -93,7 +94,8 @@ export class $$Component {
$$mount(target, anchor, hydrate) {
if (hydrate) {
this.$$fragment.l(target.childNodes);
this.$$fragment.l(children(target));
this.$$fragment.m(target, anchor); // TODO can we avoid moving DOM?
} else {
this.$$fragment.c();
this.$$fragment[this.$$fragment.i ? 'i' : 'm'](target, anchor);

@ -258,7 +258,7 @@ describe.only("runtime", () => {
assert.throws(() => {
new App({
target: {},
target: { childNodes: [] },
hydrate: true
});
}, /options.hydrate only works if the component was compiled with the `hydratable: true` option/);

Loading…
Cancel
Save