As the title describes, when you pause observers attached to an observable proxy, changes are still tracked. When the observer is resumed, any changes made while paused are also reported.
let state = {
foo: "bar"
}
let observable = observableSlim.create( state, 100, changes => console.log(changes) )
ObservableSlim.pause( observable )
state.foo = "baz"
ObservableSlim.resume( observable )
state.snah = 'bo'
the result will log both changes, despite one being made while the observer is paused.
I don't know if this is intended behavior or not, but to me it definitely feels like an oversight. This little issue cost me the better part of 2 weeks of headaches.
My solution was just to add
changes.push({
...other properties given in the push statement,
observablePaused: observable.paused
});
to both places that you do changes.push() and then filter the results in my observer function. I took this approach as the change seems 100% non-breaking to the existing code base.
As the title describes, when you pause observers attached to an observable proxy, changes are still tracked. When the observer is resumed, any changes made while paused are also reported.
the result will log both changes, despite one being made while the observer is paused.
I don't know if this is intended behavior or not, but to me it definitely feels like an oversight. This little issue cost me the better part of 2 weeks of headaches.
My solution was just to add
to both places that you do changes.push() and then filter the results in my observer function. I took this approach as the change seems 100% non-breaking to the existing code base.