Closed kbecciv closed 1 year ago
Triggered auto assignment to @sakluger (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are โ
)Verified that this is not deeplinking to the correct page. The issue only occurs when I go to that link while not signed in. If i'm already signed into the 3rd account, then it brings me to the "You don't have access to that chat" page correctly.
Job added to Upwork: https://www.upwork.com/jobs/~0194a9f940ab105839
Current assignee @sakluger is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External
)
Triggered auto assignment to @bondydaa (External
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
User always lands in the most recent chat when they access the chat by link/deep link into the chat before they log in.
This not only happens with a "user you don't have chat with" but it happens for all chats, no matter which chat you try to get in using the link, you'll always land on the most recent chat.
It's here https://github.com/Expensify/App/blob/4607dcb69b6d5bb7607f652f8a78327c7e002183/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js#L103, we're always setting the chat to the most recent chat after the user logs in.
Here're what happens:
initialParams.reportID
is always empty so according to this logic https://github.com/Expensify/App/blob/4607dcb69b6d5bb7607f652f8a78327c7e002183/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js#L100, the report screen will be reset to the most recent chat's reportID, ignoring the chat that the user is trying to get to in 1
.We need to check if the user is trying to get to a chat before logging in. If yes then do not override the chat with the most recent chat.
That means replacing this logic https://github.com/Expensify/App/blob/4607dcb69b6d5bb7607f652f8a78327c7e002183/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js#L103 with something like:
const reportScreenReportID = lodashGet(state, 'routes[0].state.routes[0].params.reportID', '');
if (!reportScreenReportID) {
Navigation.setParams(initialNextParams, reportScreenKey);
}
The above fix can be improved a bit by avoiding calculation of the initialParams
in the first place if we see that the reportID
is already present in the ReportScreen navigation param.
Looks like something related to react-navigation
may have been mentioned in this issue discussion.
As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js
files should not be accepted.
Feel free to drop a note in #expensify-open-source with any questions.
@bondydaa, @sakluger, @sobitneupane Whoops! This issue is 2 days overdue. Let's get this updated quick!
Thanks for the write up @dukenv0307, the only thing I don't think we should be doing is diving into the state
object like lodashGet(state, 'routes[0].state.routes[0].params.reportID', '');
.
I'm wondering if instead we should do something like save the reportID
from the url of /r/123
into a global state (if we have that?) or maybe into a client only onyx key (not sure this is a thing either) and then as you've said when we get to https://github.com/Expensify/App/blob/4607dcb69b6d5bb7607f652f8a78327c7e002183/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js#L100 look for that value and if it exists trigger that we load it?
@dukenv0307 We are expecting "You don't have access to this chat" screen if the reportID cannot be accessed by the user. Will your proposal yield the expected output? While testing, I could not get the expected output, the report keeps on loading instead.
While testing, I could not get the expected output, the report keeps on loading instead.
@sobitneupane I just tested again and my proposal works well.
Could you share the video that you tested?
@bondydaa We also can come up with your suggestion If do that, we can set new field (reportScreenReportID) on ONYX in here https://github.com/Expensify/App/blob/e702c3a45934767da5a5da5f70f642e0da89bcb3/src/Expensify.js#L154 And then we also need to replace this logic https://github.com/Expensify/App/blob/4607dcb69b6d5bb7607f652f8a78327c7e002183/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js#L103 with something like:
const reportScreenReportID = this.props.reportScreenReportID
if (!reportScreenReportID) {
Navigation.setParams(initialNextParams, reportScreenKey);
}
It also works for me
cc @sobitneupane
We are expecting "You don't have access to this chat" screen if the reportID cannot be accessed by the user. Will your proposal yield the expected output? While testing, I could not get the expected output, the report keeps on loading instead.
My bad. I could not reproduce it any longer.
The proposal from @dukenv0307 looks good to me. ๐๐๐ C+ reviewed
cc: @bondydaa
๐ฃ @dukenv0307 You have been assigned to this job by @bondydaa! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review ๐งโ๐ป Keep in mind: Code of Conduct | Contributing ๐
assigning @dukenv0307 but I just want to clarify which proposal @sobitneupane agreed with?
https://github.com/Expensify/App/issues/17188#issuecomment-1509764446
or
https://github.com/Expensify/App/issues/17188#issuecomment-1512830004
@bondydaa I prefer the prior proposal. The only reason is urls are subject to change, and change in url might break the solution if we use url to retrieve reportID.
In my opinion, we should come up with my first solution because it is simple and we also use the same thing in https://github.com/Expensify/App/blob/4607dcb69b6d5bb7607f652f8a78327c7e002183/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js#L102 The @bondydaa solution also be good but I see that it seems a bit complicated. @bondydaa What do your thought?
oh wow I didn't realize we were already accessing something out of state like that ๐ค.
I chatted with @tgolen real quick about that and that instance in MainDrawerNavigator.js
is more of a "do as I say, not as I do" type thing. It's a hack that was required in that particular case and should get cleaned up once the navigation library changes but isn't a pattern we should continue to repeat.
I wouldn't worry too much about urls changing, if they do then we'll update the code here as well so it still works (more $$ for contributors to fix another bug ๐). You could make the same argument that react could change the state
object at anytime and it would break as well. We can't 100% future proof anything we build so I think both arguments don't hold much weight.
So I think we should go with this https://github.com/Expensify/App/issues/17188#issuecomment-1512830004
Looks like the PR is still in review, making steady progress. (Adding this comment to make it easier to go through my K2 assigned issues).
@dukenv0307 what's the status of the PR? Looks like we may be waiting on another issue before we can test it fully?
@sakluger sorry for my delay, we cannot test the PR fully in native because have some bugs when open with deep link in native.
Looks like the PR is making steady progress and is getting close.
I'm dropping this to weekly (if botify will allow me), it's definitely not as important as Manual Request stuff which needs attention for EC3.
I'm going to move this back to daily since EC3 is happening, so this should be prioritized again.
Hey @dukenv0307 - just checking in, what's the latest on this one? I don't see any new commits or comments on the PR since May 10, is the PR held on anything?
@sakluger We are discussing in slack about a problem in the PR
Thanks, here's the Slack thread for posterity: https://expensify.slack.com/archives/C01GTK53T8Q/p1682549395857859
Looks like we came to a decision on the Slack thread. @bondydaa @dukenv0307 what's the next step here? Does the PR need to be updated now?
@sakluger We make a decision that not drop into the last report If reportID
is not present in route
. Instead, we will show a welcome screen the same as whatapps like this. That is what we discuss in Slack, wait for confirmation of @bondydaa
Sounds good, thanks! I'm OOO for the next week so I'm going to reapply the BZ label, @bondydaa let us know how we should proceed here.
Triggered auto assignment to @miljakljajic (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Apologies I am just seeing this assignment that must have come in over the weekend - I'm participating in this Guides Experiment and so have temporarily left the BZ team. Reapplying the label.
Triggered auto assignment to @stephanieelliott (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Hey @dukenv0307 can you give a status update on this PR please?
@bondydaa can you confirm here the next step we need to do?
Tossing this one back to you @sakluger since I am about to go OOO tomorrow.
Bumped Bondy in the Slack thread. He's OOO today so I don't expect a response for a day or two.
@bondydaa checking in again, mind updating with the next steps here?
left a comment on the PR.
To summarize, I think we should still implement the "default view" for when you load new.expensify.com
without any additional route and we stop automatically re-loading the most recent chat by default to display.
if a user loads new.expensify.com/settings then it should open that route/modal but with the default view displayed, not a recent chat or the chat they might have previously been viewing.
if a user loads new.expensify.com/r/123, then opens the settings modal/route then the settings modal would display above the report that is loaded but if they reloaded the page then it would just open new.expensify.com/settings with the default view again.
I don't think users care too much about maintaining the last chat they had open between reloads, if they do then they can write in and we can prioritize it then so let's keep it simple for now: if a report route is loaded then load that chat, otherwise display the default view.
okay so I'd started another thread here https://expensify.slack.com/archives/C01GTK53T8Q/p1687897551415069 and seems like we've changed course and don't really agree on adding the default screen.
I retested this bug and it doesn't exist anymore so I think the navigation refactor took care of it for us.
but I'm going to close this out for now.
if someone wants to propose the default view as a new feature and to stop auto-loading the most recent chat you can pick up the torch in that thread i linked.
@bondydaa @sakluger Should we have a payment in this issue? Because this issue was assigned and we spent sometimes to work on the PR before we changed the navigation flow to ReportScreenWrapper
that fixed this issue.
I agree that we should have a partial payment for this issue, since work was done before we decided changing direction. I'm going to pay out 50%, I think that's a fair amount given the amount of work done so far.
I sent offers to @dukenv0307 and @sobitneupane in Upwork - please let me know once you've accepted, thanks!
@sakluger Accepted the offer. Thanks.
@sakluger I've accepted, thank you!
All paid, thanks!
If you havenโt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Precondition - User A has chat with User B. User C doesn't have chat with user B. Login as user A.
Expected Result:
User lands in "You don't have access to this chat"
Actual Result:
User lands in the most recent chat
Workaround:
Unknown|
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.97.2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://user-images.githubusercontent.com/93399543/230742906-6153e1f5-c253-41df-848b-95997658c5bb.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit