Skip to content
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

on reset complete? #2090

Closed
compojoom opened this issue Jul 22, 2017 · 1 comment
Closed

on reset complete? #2090

compojoom opened this issue Jul 22, 2017 · 1 comment

Comments

@compojoom
Copy link
Contributor

Is there a way to know when a reset action has completed?
I'm running in the following issue:
Following scenes
A -> B -> C -> D

A - list items
B -> expand on a list item + additional data
C -> display just the list item from the previous screen
D -> edit this list item.

On the edit screen I have a delete button. If I delete the item - my redux store updates and screen B, C and D will trigger an error as the object they previously loaded is no longer there. That's why I'm trying to first reset the whole stack back to A and trigger the delete when on A.
This is my code:

 Actions.reset('companies');
this.props.editCompany(null);
this.props.openCompany(null);
 companyQuery.removeCompanyRecursive(this.state.company_id);

The animation is slow to start and my app crashes because I set editcompany and opencompany to null, but the previous scenes are still mounted. If I place this in a setTimeout:

this.props.editCompany(null);
this.props.openCompany(null);
 companyQuery.removeCompanyRecursive(this.state.company_id);

then it seems to work properly, but this makes the app look unresponsive. Is there a way to know when reset has completed?

@aksonov
Copy link
Owner

aksonov commented Jul 25, 2017

It is kind of duplicate #2089 - you should use Redux/MobX to manage app state.

@aksonov aksonov closed this as completed Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants