Skip to content
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

bind:this can't access #each context #2806

Closed
mrkishi opened this issue May 17, 2019 · 2 comments
Closed

bind:this can't access #each context #2806

mrkishi opened this issue May 17, 2019 · 2 comments

Comments

@mrkishi
Copy link
Member

mrkishi commented May 17, 2019

Regular prop bindings can access {#each}'s context variables. bind:this bindings, on the other hand, can't!

See: https://svelte.dev/repl/519146588bef40c1aeb8c564bb6d1d33

@primos63
Copy link

This seems to have been partially solved by issue #2333. However it introduced another issue. You can toggle the display on and off, but when toggling the display off an error is thrown. Once that happens clicking the button does nothing. Funny because I was also working on 2333 and my changes have this issue functioning as expected. Not sure if it was something in the fix for 2333 or another fix included in 3.5.4.

Error:
Uncaught (in promise) TypeError: Cannot set property 'ref' of undefined
at Object.component_binding (eval at handle_message (VM108 about:srcdoc:13), :766:16)
at Object.destroy [as d] (eval at handle_message (VM108 about:srcdoc:13), :605:12)
at destroy_each (eval at handle_message (VM108 about:srcdoc:13), :45:31)
at Object.destroy [as d] (eval at handle_message (VM108 about:srcdoc:13), :548:8)
at eval (eval at handle_message (VM108 about:srcdoc:13), :164:27)
at run (eval at handle_message (VM108 about:srcdoc:13), :18:16)
at Array.forEach ()
at run_all (eval at handle_message (VM108 about:srcdoc:13), :24:13)
at check_outros (eval at handle_message (VM108 about:srcdoc:13), :147:13)
at Object.update [as p] (eval at handle_message (VM108 about:srcdoc:13), :705:9)
component_binding @ VM111:766
destroy @ VM111:605
destroy_each @ VM111:45
destroy @ VM111:548
(anonymous) @ VM111:164
run @ VM111:18
run_all @ VM111:24
check_outros @ VM111:147
update @ VM111:705
update @ VM111:132
flush @ VM111:107
Promise.then (async)
schedule_update @ VM111:87
make_dirty @ VM111:212
(anonymous) @ VM111:246
click_handler @ VM111:761

@Rich-Harris
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants