exclude global variables from $capture_state (#4475)

pull/4472/head
rixo 5 years ago committed by GitHub
parent b8bf3643d4
commit 0786d2858d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -167,7 +167,7 @@ export default function dom(
`;
}
const capturable_vars = component.vars.filter(v => !v.internal && !v.name.startsWith('$$'));
const capturable_vars = component.vars.filter(v => !v.internal && !v.global && !v.name.startsWith('$$'));
if (capturable_vars.length > 0) {
capture_state = x`() => ({ ${capturable_vars.map(prop => p`${prop.name}`)} })`;

@ -108,7 +108,7 @@ function instance($$self, $$props, $$invalidate) {
});
}
$$self.$capture_state = () => ({ node, foo, console });
$$self.$capture_state = () => ({ node, foo });
$$self.$inject_state = $$props => {
if ("node" in $$props) $$invalidate(0, node = $$props.node);
@ -153,4 +153,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

Loading…
Cancel
Save