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

Timing or sync question #732

Open
esteinholtz opened this issue Feb 22, 2018 · 0 comments
Open

Timing or sync question #732

esteinholtz opened this issue Feb 22, 2018 · 0 comments

Comments

@esteinholtz
Copy link

I am experiencing some odd behavior with flowRouter.go. However I want to make sure I don't do something wrong:

I need to put a timeout after flowrouter.go to make it do what it is supposed to do:

FlowRouter.go("/results");
setTimeout(() => {emitter.emit ("result_table", results)}, 10);

works, but without the timeout, results are not rendered. I tried to look for some promise handling or alike, without sucess. Did I miss something?

The recipient of the emitter is a react component. Here is the relevant code:

componentWillMount() {
//emitter object is created in main.js
token = emitter.addListener('result_table', (new_result) => {
this.setState({ rows: new_result });
console.log("report new result ", new_result, " this: ", this);
});
}

componentWillUnmount() {
token.remove();
}

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

1 participant