You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-03-20] HIGH: [$500] Deeplink - User is not redirected to public room if the app is already open #36811
Please re-state the problem that we are trying to solve in this issue.
If the app is already open, the user is navigated to the login screen instead of the room.
What is the root cause of that problem?
In here, when we register the listener, we use isAuthenticated from the component state, but isAuthenticated is not in the useEffect dependency list here, so even when isAuthenticated turns from true to false, it will still remain true in the listener. Then it will not openReport on the public room here, leading to the issue.
What changes do you think we should make in order to solve the problem?
We should not depend on the component state inside openReportFromDeepLink, that utility should remain independent from any component's lifecycle and works on it's own.
Define a isAuthenticated method here and export it.
function isAuthenticated(): boolean {
return !!sessionAuthToken;
}
Use it here and remove the isAuthenticated param that relies on component lifecycle
if (reportID && !Session.isAuthenticated()) {
function openReportFromDeepLink(url: string) {
The openReportFromDeepLink cannot be used independent of any specific component, and it won't have such issues like this. The Session.isAuthenticated can be used where the authentication status is needed too.
What alternative solutions did you explore? (Optional)
changed the title [-]HIGH: [$500] Deeplink - User is not redirected to public room if the app is already open[/-][+][HOLD for payment 2024-03-20] HIGH: [$500] Deeplink - User is not redirected to public room if the app is already open[/+]on Mar 13, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.51-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
[@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@sobitneupane] Determine if we should create a regression test for this bug.
[@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@laurenreidexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
[@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
It is an edge case which could easily be missed.
[@sobitneupane] Determine if we should create a regression test for this bug.
Yes.
[@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Activity
melvin-bot commentedon Feb 19, 2024
Triggered auto assignment to @laurenreidexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.mallenexpensify commentedon Feb 19, 2024
@isagoico thinks this might be related to #36812
Adding to #vip-vsb project.
dukenv0307 commentedon Feb 22, 2024
@laurenreidexpensify Is this open to contributors? (I see it doesn't have
Help Wantedlabel but not sure if it's intentional)bernhardoj commentedon Feb 22, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Can't deep link to public room after sign-out from the app.
What is the root cause of that problem?
When we deep link to a report, it will check whether authenticated status is false.
App/src/libs/actions/Report.ts
Lines 2204 to 2206 in d33bf6e
The authenticated status is passed from this
useEffectwith an empty deps which means the value is never updated.App/src/Expensify.js
Lines 200 to 212 in d33bf6e
So, when we sign out, the authenticated status is still true, thus we can't deep link to a public room.
What changes do you think we should make in order to solve the problem?
We should put the linking listener on a new
useEffectwith authenticated status as the deps and reregister the listener.What alternative solutions did you explore? (Optional)
Create a ref for
isAuthenticatedso we don't need to re-register the listener.dukenv0307 commentedon Feb 22, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
If the app is already open, the user is navigated to the login screen instead of the room.
What is the root cause of that problem?
In here, when we register the listener, we use
isAuthenticatedfrom the component state, butisAuthenticatedis not in theuseEffectdependency list here, so even whenisAuthenticatedturns from true to false, it will still remaintruein the listener. Then it will notopenReporton the public room here, leading to the issue.What changes do you think we should make in order to solve the problem?
We should not depend on the component state inside
openReportFromDeepLink, that utility should remain independent from any component's lifecycle and works on it's own.To do that we can use the same approach we're already using for the
isAnonymousUsercheck.isAuthenticatedmethod here and export it.isAuthenticatedparam that relies on component lifecycleThe
openReportFromDeepLinkcannot be used independent of any specific component, and it won't have such issues like this. TheSession.isAuthenticatedcan be used where the authentication status is needed too.What alternative solutions did you explore? (Optional)
NA
melvin-bot commentedon Feb 23, 2024
@laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Feb 23, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01615ede560b1898a9
25 remaining items
[-]HIGH: [$500] Deeplink - User is not redirected to public room if the app is already open[/-][+][HOLD for payment 2024-03-20] HIGH: [$500] Deeplink - User is not redirected to public room if the app is already open[/+]melvin-bot commentedon Mar 13, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 13, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.51-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-03-20. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 13, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
sobitneupane commentedon Mar 20, 2024
#18293
#18293 (comment)
It is an edge case which could easily be missed.
Yes.
#36811 (comment)
sobitneupane commentedon Mar 20, 2024
Regression Test Proposal
Do we agree 👍 or 👎
laurenreidexpensify commentedon Mar 21, 2024
Payment Summary:
C+ @sobitneupane $500 please request in newdot
Contributor: @dukenv0307 $500 payment issued in Upwork
JmillsExpensify commentedon Mar 22, 2024
$500 approved for @sobitneupane based on summary.