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

Fix: Empty any arrays if item in group is an object to remove from group #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tmurph21
Copy link

Currently the removeItem method does not fully remove an object from the group if the object has any nested arrays as values

@tmurph21 tmurph21 changed the title Empty any arrays if item in group is an object to remove from group Fix: Empty any arrays if item in group is an object to remove from group Nov 17, 2020
@justin-schroeder
Copy link
Member

Interesting, can you provide a reproduction example of how the current state is insufficient or incorrect? I need some convincing that splicing an array (which could have object references outside of the scope of VF) makes the most sense here as opposed to just removing it's reference from the model, but I'm genuinely interested to see the use case.

If we move forward on this one, it would be great to get a backing test(s) for it in this PR too. Thanks!

@tmurph21
Copy link
Author

tmurph21 commented Nov 19, 2020

Here is an example: https://codesandbox.io/s/peaceful-sanderson-0cwco?file=/src/App.vue

The error occurs when you attempt to remove an item in the group IF the nested group an object with keys

Conditions:
-- If nested group has no keys in object -- never an issue
-- If length > 1 && remove index 0 -- it seems to work
-- If length > 1 && remove index > 0 -- issue persists
-- If length === 1 && remove index 0 -- issue persists

Note: I have not tested more than 1 level deep (so probably need to test this to see if recursion is needed)

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

Successfully merging this pull request may close these issues.

2 participants