tur-nr / polymer-redux

Polymer bindings for Redux.
https://tur-nr.github.io/polymer-redux
MIT License
440 stars 67 forks source link

Asynchronous property update nightmare #107

Closed under24 closed 6 years ago

under24 commented 7 years ago

I have a few properties that rely on the state (bottom).

Every time the component is attached to the document it pulls the value from state one by one. i.e. If foo is assigned a value and its observer is fired then bar is still undefined. It's not a problem if you have 2 properties so you can check if they have been initialized but if you have 20+ properties it becomes a mess which is very hard to maintain.

Is there a way to assign values to every property and only after that call observers (notify polymer that the value is changed) one by one? So every observer can access any property without checking if it's undefined or not.

          foo: {
            statePath: 'foo',
            observer: 'observeFoo'
          },
          bar: {
            statePath: 'bar',
            observer: 'observeBar'
          }
tur-nr commented 7 years ago

Can you try your scenario from the changes in master. I think the work @mkorenko has done resolves your observing issues.

Please let me know the outcome as I would like to get a release out. Thanks 👍

under24 commented 6 years ago

@tur-nr Omg! it actually made the trick. Now the first observer is fired after every property has a value. Thanks a lot.

tur-nr commented 6 years ago

v1.0.4