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
Notifying consecutive array changes #2752
Comments
I've found in code doc:
So does it mean that not only "splice records" but also Could you then provide some rules what precisely this normalization means? For example, do I get correctly that after 2 splices and one regular change array.splice(3, 2, itemD);
array[4].prop = "new";
array.splice(2, 2, itemTwo, itemThree); I should notify about 3 different ones, and normalize also
? |
BTW, do you really want to keep such constraint? As I could imagine the case, when someone (component inside) may listen to changes to perform some animation. There will be no way to notify about the change that should animate push then shift from a list. |
Is there a chance for fixing this? |
@kevinpschaaf I'm trying to document Is there a reference somewhere to what we mean by "normalized/merged"? If this is not easily achievable, maybe we need to consider a 'forced update' method as has been requested in some other issues. I was able to do that using code like this:
Shouldn't there be an easier way to say , "This really isn't the same array anymore. Please throw away the backing collection and start over."? |
Thanks @arthurevans for support. Unfortunately, the method you proposed does not fit my case well, as it binds to a copy of an array, what breaks integration with other parts of an app. |
The "splices records must be normalized to be in index order" can be achieved using an algorithm used by the ObserveJS library from Polymer 0.5 days, which takes splices that happened to an array over time and re-projects them to an equivalent in-order set of splices. That said, in Polymer 2.x it is now possible to just call |
I'm trying to notify
dom-bind
on array changes, withnotifySplices
, but I cannot get DOM aligned to my model.Here is live example: http://jsbin.com/burako/2/edit?html,console,output
I modify array, outside of Polymer:
Then I end up with
model = {array: [{prop:1}]}
and nothing in the DOM.The text was updated successfully, but these errors were encountered: