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

App hangs on use of Actions.refresh() #2791

Closed
sujay-bidchat opened this issue Jan 12, 2018 · 5 comments
Closed

App hangs on use of Actions.refresh() #2791

sujay-bidchat opened this issue Jan 12, 2018 · 5 comments

Comments

@sujay-bidchat
Copy link

Version

Tell us which versions you are using: 4.0.0-beta.24

Expected behaviour

App should not hang after rendering view using Actions.refresh(); on NavigationBar after performing some action such as API call.

Actual behaviour

App hangs after rendering view using Actions.refresh(); on NavigationBar after performing some action such as API call / in-app logic.
Error: Maximum call stack reached
XHR finished loading: POST "http://localhost:8082/callback_result".
XHR finished loading: POST "http://localhost:8082/call_method".

@simonso3
Copy link

I encountered similar problem after migrated to v4, especially when doing Action.refresh in componentDidMount. The setTimeout temporary workaround seems to have worked for me.

setTimeout(() => {
  Actions.refresh({
    param1: 'blah1',
    param1: 'blah2',
  });
}, 0);

@sujay-bidchat
Copy link
Author

@simonso3 that workaround do not seam to work for me.

@simonso3
Copy link

Are you calling it multiple times relatively quickly? I had the same problem when I discovered a bug in my code that I was calling refresh multiple times unnecessarily.

@evianzhow
Copy link
Contributor

@simonso3 I encountered this when calling Actions.refresh() both on componentDidMount and componentWillReceiveProps. Former is to set a default navigation bar component, latter is to update it. If Actions.refresh() fired too quickly, RNRF will loop in Navigation/SET_PARAMS and cause app to freeze.

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Use setTimeout for this.

@aksonov aksonov closed this as completed Aug 8, 2018
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

4 participants