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
Crash: sometimes will crash at this point, what can i do to find the root cause #497
Comments
Looking at the left side, it appears this is breaking on a background thread. ReSwift does not support multi-threading and will crash if you dispatch an actions from multiple threads. Take a look at the dispatch you're making an ensure its sent on the thread you're using ReSwift (usually main) |
our structure: |
Yes, this is fine. |
Sorry, mistakenly closed and submitted my comment prematurely. Subscribing and dispatching in viewDidLoad sounds fine, yes. |
Another thing that block me is when to clear the data on the store? I hope you can give me some advice, thank you very much |
I would not recommend async'ing all function calls, there are many cases where you want dispatches to happen synchronously (eg user input). You should instead consider each thunk and ensure its asyncing to the main thread itself before |
@LivenChief +1 to what @mjarvis said. This is still a good rule of thumb:
Your goal then would be to make it so that everything that dispatches to a BG queue eventually ensures that the main queue is reached again. Sprinkle in some |
thank you very much,guys |
Hi @DivineDominion @mjarvis |
@LivenChief Sorry, I can only 80% follow :) If you want to make sure that N subviews receive a state update in a specific order, don't subscribe each of these. Instead, subscribe a common ancestor and make it forward the relevant information to its child views. (In technical terms, it's up to you to express the intent of updating views in a specific seauence.) If I'm getting this wrong, can you share a pseudo code example? |
The text was updated successfully, but these errors were encountered: