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

Warning about using refs in event binding #686

Closed
antony opened this issue Jun 29, 2017 · 2 comments
Closed

Warning about using refs in event binding #686

antony opened this issue Jun 29, 2017 · 2 comments

Comments

@antony
Copy link
Member

antony commented Jun 29, 2017

It is useful to call methods on nested components by making use of refs in event bindings. Whilst this is possible, and works well, Svelte issues a warning when compiling. I would expect Svelte to either not issue a warning, or to not work - right now it does both.

The error is:

'refs.nested.toggleEggs' is an invalid callee (should be one of this.*, event.*, set, fire or destroy)

The ideal resolution for me is to add 'refs.*' as an allowed callee.

Svelte REPL example - open the console to see the warning:

https://svelte.technology/repl?version=1.23.4&gist=b8cd68ce59240062798c647474e1782a

@Rich-Harris
Copy link
Member

The ideal resolution for me is to add 'refs.*' as an allowed callee

Me too. Didn't actually realise that this already works! We'll have to add some tests to guard against it no longer working.

Rich-Harris added a commit that referenced this issue Jul 29, 2017
Rich-Harris added a commit that referenced this issue Jul 29, 2017
@Rich-Harris
Copy link
Member

This is added in 1.27 (i.e. no more warning. It will throw an error if you use a ref that doesn't exist)

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

No branches or pull requests

2 participants