-
Notifications
You must be signed in to change notification settings - Fork 67
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
Computed property for nodes and config #22
Comments
@Gurzhii, I found the same. It works if I use Vue 3 refs, but using computed properties(Pinia getters) is not working. I think I will check the package's source code to see if I can find the issue and a workaround for it. |
@Gurzhii @N00ts, here's a quick update: The tree will only work as expected if you pass a reactive property such as ref or reactive. This is because the nodes are a computed property here:
From the docs:
Just an example so you can understand: This is reactive:
This is NOT reactive:
When you have computed properties not relying on reactive data, Vue returns a plain object instead of a Proxy. Also, when using @N00ts That said, I think that a good solution could be checking if the refs are reactive already, if not, we can create a ref with the value and ensure that is reactive, something like this:
What do you think? |
@N00ts If this looks good, I will be happy to open a pull request. |
Looks fine ! Or maybe juste error message to avoir people making this mistake ! |
Yes but just a warning message can be a good thing instead of letting people having bad practices about Reactivity, don't you think ? |
Hello! First of all, I want to thank you for the job you've done!
I have one question, I can't find in the docs. How can I use nodes and config as computed properties? It's not working for me at all. It renders the structure but select/expand features are not working at all.
Issue: I need to combine data from the parent with the initial tree state. (parent data is reactive and may be changed on the fly, so I need to use computed prop in the child component where I have the tree)
Example: https://codesandbox.io/s/basic-forked-h5h960?file=/src/App.vue
The text was updated successfully, but these errors were encountered: