-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loop protect guard issue in REPL #4034
Comments
In the generated code: function instance($$self, $$props, $$invalidate) {
let node;
(function () {
const guard = loop_guard(100);
while (false) {
guard();
}
})();
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
$$invalidate(0, node = $$value);
});
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ("node" in $$props) $$invalidate(0, node = $$props.node);
};
return [node, guard, div_binding];
}
|
@Conduitry: I couldn't get a setup outside of the REPL that generated a guard, what's the trick? (I tried with |
You also need to pass a non-zero |
The problem seems to be the Edit: Ohhhh. In the example in this issue, it's in a deeper scope. But in the loop-protect test, the loop is at the top level. Duh. I think we can just wrap the whole loop in a cc @tanhauhau |
Fixed in 3.16.1 - https://svelte.dev/repl/bind-this?version=3.16.1 - and will work again on the main examples page once unpkg's cache is refreshed. |
Describe the bug
The bind this example doesn't work in 3.16.0 (it does in 3.15.0)
To Reproduce (minimal example)
Produces
guard is not defined
.See REPL (it does work on 3.15.0).
Note that the
bind:this
is actually needed to trigger this. It's probably a visibility issue with the guard and an anonymous function?The text was updated successfully, but these errors were encountered: