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

Node.id is changing on select in Vuex #83

Open
thardraved opened this issue Nov 22, 2018 · 6 comments
Open

Node.id is changing on select in Vuex #83

thardraved opened this issue Nov 22, 2018 · 6 comments

Comments

@thardraved
Copy link

Hello. Not sure if anyone posted this before (may be related to #69 tho), but there is a bug in ids when using Vuex. You can take a look at it here. When you click on the node in Vuex tree it changes its id. For example, if you need to pass data of currently clicked node to custom context menu (to remove node, for instance) the node with old id is passed, which makes it impossible to find this node afterwards.

Btw, thanks for the component, saved me a lot of time. Good luck with that!

@kl3sk
Copy link
Contributor

kl3sk commented Nov 27, 2018

Hello,

This is because every time you click on the tree it raise the dispatcher handler and because you don't set any id, it auto-generate one.

I don't really understand how it works, because my problem is, when i click on it after the first load that is has a good structure.
It change all data for its internal one and remove all my properties.

I think this could be better explained in the docs.

@kl3sk
Copy link
Contributor

kl3sk commented Nov 27, 2018

Ok so I can confirm this is true the first load seems ok, but when you "dispatch" all id are reset to undefined and re-generated by uuidV4 function.

This is very annoying, especially when you rely on the Id.

Please @amsik did you have any idea ?

@amsik
Copy link
Owner

amsik commented Nov 27, 2018

Hi! I know about the issue. Please take a look at #81

@kl3sk
Copy link
Contributor

kl3sk commented Nov 27, 2018

I look into it, but I didn't really understand what you mean.

@amsik
Copy link
Owner

amsik commented Nov 27, 2018

Data structure:

 const data = [
   { text: 'Item 1', data: {id: 1} },
   { text: 'Item 2', data: {id: 2} }
 ]

This ID is not generated automatically but it is never being rewritten

@kl3sk
Copy link
Contributor

kl3sk commented Nov 27, 2018

Ok it works this way. So i if I understand data.id is used internally and shouldn't be used for other purposes .

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

3 participants