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

Try to set key in get call error #52

Closed
dredzone opened this issue May 29, 2019 · 2 comments
Closed

Try to set key in get call error #52

dredzone opened this issue May 29, 2019 · 2 comments
Labels

Comments

@dredzone
Copy link

emitting custom event from inner element element and attempting to set outer element property causes "Try to set key in get call" error

@smalluban
Copy link
Contributor

smalluban commented May 29, 2019

Can you provide a failing example? It can be on some online editor. It looks, that you dispatch event inside of the getter, which then observed (synchronously) by another element try to set its own property.

Cache mechanism wraps get and set methods, and saves dependent get calls invoked inside. To prevent an endless loop of setting and getting and to protect the correct dependency tree, it is forbidden to set properties inside of the getter.

One solution can be triggering event asynchronously, like this:

Promise.resolve().then(() => dispatch(host, 'your-event-type', ...));

However, I would advise to not create side effects inside of the getter and use today introduced observe method.

@smalluban smalluban added bug help and removed bug labels May 29, 2019
@dredzone
Copy link
Author

moving dispatch event into observe does the trick, thank you.

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

No branches or pull requests

2 participants