0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
This commit is contained in:
Rich Harris 2019-10-18 20:40:06 -04:00 committed by GitHub
parent 6a98febf5f
commit db901725ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,17 +224,12 @@ export default function dom(
component.rewrite_props(({ name, reassigned, export_name }) => {
const value = `$${name}`;
let insert: Node[];
if (reassigned || export_name) {
insert = b`${`$$subscribe_${name}`}()`;
} else {
const callback = x`$$value => $$invalidate('${value}', ${value} = $$value)`;
insert = b`@component_subscribe($$self, ${name}, $${callback})`;
}
const insert = (reassigned || export_name)
? b`${`$$subscribe_${name}`}()`
: b`@component_subscribe($$self, ${name}, #value => $$invalidate('${value}', ${value} = #value))`;
if (component.compile_options.dev) {
insert = b`@validate_store(${name}, '${name}'); ${insert}`;
return b`@validate_store(${name}, '${name}'); ${insert}`;
}
return insert;