-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
reactnavigation: ignore state change when getCurrentRoute() is undefined #2484
reactnavigation: ignore state change when getCurrentRoute() is undefined #2484
Conversation
Hi, Could you describe simple example, when do you get undefined current route? |
Hi! I'm afraid I'm not sure how exactly to simply reproduce it. I have a big app and there are two general flows: for signed in and not signed users. The app spends some time to check if the user signed in and only then mounts the stack of screens. I've noticed that during this time I see two triggers of |
@i1skn Thanks for the description. I'm just making sure, that we are not changing something intentional. |
@i1skn Hi, I'm still not sure if the change is correct. Would you be able to make a small example app were it will show the behaviour? Because the Or it could be that the current route is |
@krystofwoldrich thanks for coming back to me.
To summarize: we should either cancel the transaction or do nothing to it. Right now we just sort of prevent it from being updated, which to my opinion is incorrect. But cancelling the transaction, as we do when route has changed too quickly is dangerous here, cause at least in my case I will loose Let me know your thoughts on this, thanks! |
@i1skn What you're saying make sense to me. Could you share a link to transaction, where the name is not assigned. |
@i1skn Thank for the details you send privately. It took me a while to grasp what should be the correct behaviour. |
📢 Type of change
📜 Description
In
src/js/tracing/reactnavigation.ts
:When
_onStateChange
is called andgetCurrentRoute()
isundefined
,then the reference
this._latestTransaction
would be cleared and next time, when state is changed andgetCurrentRoute()
is not undefined - it would not update the transaction with metadata from the route, cause it thinks we've already done that.💡 Motivation and Context
This bug result in
Route Change
events instead of named with the actual route.💚 How did you test it?
Just modified the code and saw that now
Route Change
events are called properly with the actual routes names.📝 Checklist
🔮 Next steps