omniscientjs / immstruct

Immutable data structures with history for top-to-bottom properties in component based libraries like React. Based on Immutable.js
374 stars 21 forks source link

'next-animation-frame' with multiple structures #49

Closed jeroencranendonk-wf closed 9 years ago

jeroencranendonk-wf commented 9 years ago

If you create multiple instances of Structure, event handlers registered for 'next-animation-frame' are only called for the first instance for which queuedChange was false.

If multiple Structure instances are modified within a frame, this leads to event handlers not being called when expected.

I see two possible solutions:

jeroencranendonk-wf commented 9 years ago

Assuming that is unintended behavior, anyway :) I know that it caused issues for me, although it could be that I am using Immstruct in unexpected ways.

mikaelbr commented 9 years ago

Hi! Sorry for the late response. I was thinking of this while writing it. I thought it made sense to share queued change and batch all change, but it might make more sense to be able to not "share state" between instances.