You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have several actions that are chained one after another in this manner:
Action is dispatched
A StoreSubscriber receives newState callback on state change
It dispatches another Action on the same Store
Another StoreSubscriber (or maybe the same one) receives newState callback on state change
It dispatches another Action on the same Store
These chains are not infinitely recursive, their depth is 2-4 actions. They all operate on single (main) thread synchronously. We see a crash when 2nd or 3rd dispatch is called inside ReSwift. It occurs with different action sequences. One case we can reproduce 100% in debug configuration (-Onone), but it's not reproduced in release configuration.
Stacktrace top is __swift_instantiateConcreteTypeFromMangledName
The text was updated successfully, but these errors were encountered:
I recommend against this pattern -- It could be running into call-stack or memory-stack restrictions, due to not allowing the runloop to complete and reset.
If you need to, dispatching the chained actions should resolve the issue, as they'll occur on the next runloop and have the available resources again.
Better is to handle the state changes within the singular, first action. If its all synchronous, then technically there is no need for the follow-up actions. You can add the first action to the reducers appropriately.
@mjarvis This would be an example of (ab)using ReSwift as a general-purpose tool to decouple and implement messaging between components, something we brushed a couple of years ago, right?
We have several actions that are chained one after another in this manner:
newState
callback on state changenewState
callback on state changeThese chains are not infinitely recursive, their depth is 2-4 actions. They all operate on single (main) thread synchronously. We see a crash when 2nd or 3rd
dispatch
is called inside ReSwift. It occurs with different action sequences. One case we can reproduce 100% in debug configuration (-Onone), but it's not reproduced in release configuration.Stacktrace top is
__swift_instantiateConcreteTypeFromMangledName
The text was updated successfully, but these errors were encountered: