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

Not working with computed dataset #15

Open
bifshteks opened this issue Dec 11, 2020 · 4 comments
Open

Not working with computed dataset #15

bifshteks opened this issue Dec 11, 2020 · 4 comments

Comments

@bifshteks
Copy link

When using computed properties as :dataset such as:

computed: {
    myDataset() {
        return {value: '1'}
    }

vue throws [Vue warn]: <transition-group> children must be keyed: <div> and the tree does not render properly

@Dongbox
Copy link

Dongbox commented Dec 21, 2020

I changed his VueTree.vue and just replace the node.data._key with index that it can run for me.
In line 15:
... :key="index" ... >

@wrkyle
Copy link
Contributor

wrkyle commented Feb 25, 2021

@bifshteks When the VueTree component is created it runs a method called addUniqueKey which iterates through the dataset and assigns a UUID to each node, called _key. This _key is not only used as a unique key for the v-for but also as an identifier when drawing links with SVG and d3. When the dataset changes the draw method is called but addUniqueKey is not. If any new nodes have been added to the dataset they will not have a _key and the warning will be thrown. This may cause the card rendering error and d3 may not be able to identify the link to draw.

The most efficient solution might be to call addUniqueKey each time the dataset changes but modify it to check if each node already has a _key and not recreate it if it does. I might create a pull request for this a little later.

@jackieha
Copy link

请问这个问题解决了吗? 急需该功能

@Maxim-Durand
Copy link
Contributor

This issue should've been fixed with 0eff2fd.

Please try to pull latest version and see if it's still an issue.

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

5 participants