-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Navigating to a chat you can't access results in a blank screen #3810
Comments
Triggered auto assignment to @bfitzexpensify ( |
Hello, if you decide to make this external I have a proposal. It should be as simple as refactoring const ReportView = ({reportID, report, session}) => {
if (!report.reportID) {
return (
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>
<Text style={[styles.h1]}>404</Text>
</View>
);
}
return (
<View nativeID={CONST.REPORT.DROP_NATIVE_ID} key={reportID} style={[styles.flex1, styles.justifyContentEnd]}>
<ReportActionsView reportID={reportID} />
{session.shouldShowComposeInput && (
<SwipeableView onSwipeDown={() => Keyboard.dismiss()}>
<ReportActionCompose
onSubmit={text => addAction(reportID, text)}
reportID={reportID}
/>
</SwipeableView>
)}
<KeyboardSpacer />
</View>
);
}; and also map report to props via export default withOnyx({
report: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
},
session: {
key: ONYXKEYS.SESSION,
},
})(ReportView); also adjust proptypes accordingly. I'll obviously adjust the looks and text to whatever is required by your design team. The benefit of doing it like this over redirecting to some different page is the fact that user can use sidebar to switch to a chat he has access to and start chatting right away. Or logout and login with his second account to open the chat he didn't have access to with his previous account. Basically, all the UI is available right away, thus better UX. |
PROPOSAL We can throw an error if we have no access to that chat and catch an error in Thanks |
Triggered auto assignment to @Beamanator ( |
Good find, looks like it's easily reproducible by just navigating to https://staging.expensify.cash/r/25 - a.k.a. a report you don't have access to. Marking |
Triggered auto assignment to @kadiealexander ( |
Triggered auto assignment to @marcaaron ( |
Hi Posting my comment for this job on Upwork https://www.upwork.com/jobs/React-Native-Fix-issue-where-link-click-results-blank-screen-3476_~018b221693212487f0/ My Profile is https://www.upwork.com/freelancers/~014125b829d935f4b8 My comment: I think you must skip some thing, Your component renders before your response comes, you must have to do the following things: Please check the server response, if everything is fine, Then apply conditional statement at the response, so that response is visible after the component renders and if there is no data then inside condition you can add 404 or some component that represent 404. I greatly look forward to a positive response. Thanks |
@dklymenk How will we differentiate between a report that "hasn't yet loaded" and one that we are "unable to access". There is a subtle difference and I think the solution you are providing might lead to a brief flash of a 404 while we are waiting for a report to load.
@aliabbasmalik8 This proposal could work, but is missing how we'd determine the user has no access to the chat @mygit1313 This proposal could be on the right track but needs to be more specific Ultimately, I'm not sure if we want to redirect to a 404 page or just use an error growl and redirect the user to a report they can access (like 1:1 w/ Concierge), but maybe @Expensify/design has ideas. I know we had previously discussed showing a 404 page (which actually still exists here but is unused). As for detecting whether a user truly has access to a report or not. I'm not sure whether it's enough to look and see if it exists in storage. There could be any number of reasons why the report isn't there (and a user could still be able to access it). |
In my testing this was not the case. I think I specifically did it in that exact component because screen.mp4
If I understand correctly, only way to get access to a report that is not in your initial list of reports (the one you get from BE via |
I'll ask this another way :) If for some reason the user should have access to the report, but it just hasn't loaded yet - then we are showing them a 404 in that case. To test this you would need to remove the report you are trying to access from
Reports can also be shared with you, but you are describing how to create a new chat. To tell if you have access to a chat we could use something like {
"jsonCode": 404,
"message": "Auth Get returned an error",
"codeRevision": "0000000000000000000000000000000000000000",
"requestID": "EUfCx4"
} We try to load all the chats you have access to when the app first inits which calls that API (see code here). But the absence of a report doesn't necessarily mean that a user has no access to it. It could still be loading.
Sorry, what exactly did you try? It makes sense to me that you'd see an error, but not really sure how this connects to your previous point. Thanks! |
You're right. Deleting the report from localstorage manually and refreshing the page leads to 404 with my proposal. Still, I don't understand how to reproduce this state without touching local storage. After logging out and logging in I don't see 404 during or after loading.
I mean. I've tried to create a new chat with a person I've never had a chat with, and there was no 404 message. Anyway, I think I see what you're getting at. Even if it works right for me right now, it might not work down the line since even some minor change to how we store, handle or even fetch the data could lead to 404 flashing. Using secondary properties of data objects to show an error message is not a good practice anyway. |
To be honest, it's just a hunch. I'm not sure how likely it would be in ideal networking scenarios, but the case I'm thinking of is...
|
We can do this using for this case, we can throw an error like this way
and catch in NOTE
|
@aliabbasmalik8 Not sure we need to use the error boundary. If we are only using it so that we can catch a thrown error then it could make more sense to redirect to a 404 screen, show a quick error growl, or a confirm modal that redirects you back to the site root @Expensify/design thoughts on what we should prefer here? As for creating something like We could perform this in
|
I am having a little difficulty following all of the conversation, but I think in general I like the idea of just punting the user to a chat they can see (maybe it was the last chat the user was viewing) and then launching either a growl or a little confirm modal that says the chat can't be found. Is that what you were thinking Marc? |
That works for me! So we would essentially need to:
|
Looks like the flow should be something like:
Does this looks OK @marcaaron? |
Looks mostly like what I had in mind @rdjuric, but now thinking we may just want to call e.g. if there's only one |
I think we've got enough of an understanding to hash this out in a PR. |
@rdjuric hey man! I can't seem to find you on Upwork to hire you for this issue. Could you please let me know if you've submitted this under a certain name? |
Sorry @kadiealexander! Totally forgot to submit a proposal on Upwork. Just did it under the same name as my github. |
PR was merged 8 days ago, payment issued in Upwork today. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
Get redirected to a 404 page or something.
Actual Result:
LHN is visible but report view displays a white screen with no additional information
Workaround:
N/A
Platform:
All
Version Number: version: "1.0.74-0"
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
View all open jobs on Upwork
The text was updated successfully, but these errors were encountered: