-
Notifications
You must be signed in to change notification settings - Fork 92
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
Clear reactive array #277
Comments
This seems like a tricky bug in VanX. Handling the In the meantime, you can use |
Now I got the problem that vanX.list does not work as I expect
|
If you're using |
Thank. This helped, I wrote |
it would be great if |
When using |
I am not sure what you meant here. When using |
Yes, indeed, this problem does not exist now, I forgot to update vanX. However, I noticed that I'm exporting the latest versions, it would be nice to have a
|
This is intended behavior. By allowing "holes" in the array, we don't have to do lots of DOM updates whenever an item is deleted. Basically, you can control when to do the compaction with |
I don’t understand well, but what is the logic in leaving empty cells in the array? To fill them or what to do with them? Leave empty until better times? :-) How can I disable Proxy? |
We leave cells empty until better timing. Let's say we have a reactive array If we allow empty cells, the array will become If we don't allow empty cells, the array will become
To clarify, by breaking the connection, do you mean to avoid the detection of dependency from one reactive object to another reactive object? Do you have the full piece of code to illustrate your use case? |
Hi @creatormir, FYI, VanX 0.2.5 was just released which fixed the issue of array length binding. Your example is now working in jsfiddle: Thank you so much for reporting the bug! |
@all-contributors please add @creatormir for bug |
I've put up a pull request to add @creatormir! 🎉 |
@creatormir, one caveat is that because holes might exist in the array, the |
That is, doing this is incorrect (not effective)?
It's effective to do this?
or
|
Both of the approaches work. The 2nd approach ( |
@creatormir, FYI, the caveat was added to VanJS website: https://vanjs.org/x#caveat-array-holes. |
Nice work, but there's still room for optimization! Instead of relying on |
How to increase the precision of arr.length in van.derive? Currently length == 0 is not possible.
https://jsfiddle.net/creatormir/cbaey9n3/
The text was updated successfully, but these errors were encountered: