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

Store - Cyclical Dependency Detected when child computed property defined before parent & grand-parent computed proprety #1399

Closed
btakita opened this issue May 1, 2018 · 4 comments

Comments

@btakita
Copy link
Contributor

btakita commented May 1, 2018

Edge Case: When store.compute is called to define a child that refers to a parent and a grand-parent computed property, a Cyclical Dependency Detected error occurs.

https://svelte.technology/repl?version=2.4.1&gist=4a4c7371386120a1ed9878b5da741d41

@btakita btakita changed the title Store - Cyclical Dependency Detected when child computed property defined after parent Store - Cyclical Dependency Detected when child computed property defined before parent May 1, 2018
@btakita btakita changed the title Store - Cyclical Dependency Detected when child computed property defined before parent Store - Cyclical Dependency Detected when child computed property defined before parent computed proprety May 1, 2018
@btakita btakita changed the title Store - Cyclical Dependency Detected when child computed property defined before parent computed proprety Store - Cyclical Dependency Detected when child computed property defined before parent & grand-parent computed proprety May 1, 2018
@btakita
Copy link
Contributor Author

btakita commented May 1, 2018

https://svelte.technology/repl?version=2.4.1&gist=0d39be6e28701514a3d1705ad2c151df works, as the child is defined after the grand-parent & before the parent.

@btakita
Copy link
Contributor Author

btakita commented May 1, 2018

It would also be great if the "Cyclical Dependency Detected" error message could include the property names.

@btakita
Copy link
Contributor Author

btakita commented May 2, 2018

Looks like performing if (visited[key]) return; before if (cycles[key]) { fixes the issue.

https://svelte.technology/repl?version=2.4.1&gist=0343cdb56da5862510ddafa9ac467dec

Rich-Harris added a commit that referenced this issue May 2, 2018
Rich-Harris added a commit that referenced this issue May 3, 2018
@Rich-Harris
Copy link
Member

fixed in 2.4.2, thanks

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