pull/4923/head
pushkine 5 years ago
parent 2b6e4dc963
commit c2a701fece

@ -77,10 +77,8 @@ export default function dom(
const props = component.vars.filter(variable => !variable.module && variable.export_name);
const writable_props = props.filter(variable => variable.writable);
const omit_props_names = component.get_unique_name('omit_props_names');
const rest = uses_rest ? b`
const ${omit_props_names.name} = [${props.map(prop => `"${prop.export_name}"`)}];
const #keys = new Set([${props.map(prop => `"${prop.export_name}"`).join()}]);
const $$restProps = {};
for (#k in $$props) {
if (!#keys.has(#k) && #k[0] !== '$') {
@ -405,9 +403,8 @@ export default function dom(
const i = renderer.context_lookup.get($name).index;
return b`
let ${$name},
${unsubscribe} = @noop,
${subscribe} = () => {
let ${$name}, ${unsubscribe} = @noop;
const ${subscribe} = () => {
${unsubscribe}();
${unsubscribe} = @subscribe(${name}, (#value) => { $$invalidate(${i}, (${$name} = #value)); });
return ${name};

@ -36,7 +36,7 @@ export default function ssr(
const rest = uses_rest
? b`
let #k;
const #keys = new Set([${props.map(prop => `"${prop.export_name}"`)}]);
const #keys = new Set([${props.map(prop => `"${prop.export_name}"`).join()}]);
let $$restProps = {};
for (#k in $$props){ if (!#keys.has(#k) && #k[0] !== '$'){ $$restProps[#k] = $$props[#k];}}`
: null;
@ -59,7 +59,7 @@ export default function ssr(
component.rewrite_props(
({ name }) =>
b`
${component.compile_options.dev && b`@validate_store_dev(${name}, '${name}');`}
${component.compile_options.dev && b`@validate_store(${name}, '${name}');`}
@subscribe(${name}, (#v) => { ${`$${name}`} = #v; })();`
);

Loading…
Cancel
Save