fix trying to update unmounted input

pull/3848/head
AlbertLucianto 6 years ago
parent a3cc276a90
commit c2a8e3688f

@ -97,6 +97,7 @@ export default class BindingWrapper {
const type = parent.node.get_static_attribute_value('type'); const type = parent.node.get_static_attribute_value('type');
if (type === null || type === "" || type === "text" || type === "email" || type === "password") { if (type === null || type === "" || type === "text" || type === "email" || type === "password") {
update_conditions.push(parent.var);
update_conditions.push(x`(${parent.var}.${this.node.name} !== ${this.snippet})`); update_conditions.push(x`(${parent.var}.${this.node.name} !== ${this.snippet})`);
} }
} }

@ -39,7 +39,7 @@ function create_fragment(ctx) {
p(changed, ctx) { p(changed, ctx) {
if (changed.foo) set_data(t0, ctx.foo); if (changed.foo) set_data(t0, ctx.foo);
if (changed.foo && input.value !== ctx.foo) { if (changed.foo && input && input.value !== ctx.foo) {
set_input_value(input, ctx.foo); set_input_value(input, ctx.foo);
} }
}, },

@ -49,7 +49,7 @@ function create_fragment(ctx) {
if (changed.z) bar_changes.x = ctx.z; if (changed.z) bar_changes.x = ctx.z;
bar.$set(bar_changes); bar.$set(bar_changes);
if (changed.z && input.value !== ctx.z) { if (changed.z && input && input.value !== ctx.z) {
set_input_value(input, ctx.z); set_input_value(input, ctx.z);
} }
}, },

@ -44,7 +44,7 @@ function create_fragment(ctx) {
append(form, button); append(form, button);
}, },
p(changed, ctx) { p(changed, ctx) {
if (changed.test && input.value !== ctx.test) { if (changed.test && input && input.value !== ctx.test) {
set_input_value(input, ctx.test); set_input_value(input, ctx.test);
} }
}, },

Loading…
Cancel
Save