Repository navigation
fix: Not here page is displayed when a member deletes an expense #81620
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
Changes from all commits
c645f70
021717f
588972a
3b72a46
f44ea93
b78595b
5b33e8e
7b9097b
e4c0855
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ | |
| getReportAction, | ||
| isMoneyRequestAction, | ||
| } from '@libs/ReportActionsUtils'; | ||
| import {isValidReportIDFromPath} from '@libs/ReportUtils'; | ||
| import {isMoneyRequestReport, isValidReportIDFromPath} from '@libs/ReportUtils'; | ||
| import {isDefaultAvatar, isLetterAvatar, isPresetAvatar} from '@libs/UserAvatarUtils'; | ||
| import Navigation from '@navigation/Navigation'; | ||
| import ReactionListWrapper from '@pages/inbox/ReactionListWrapper'; | ||
|
|
@@ -65,10 +65,32 @@ | |
| const reportIDFromRoute = getNonEmptyStringOnyxID(route.params?.reportID); | ||
| const {currentSearchResults: snapshot} = useSearchContext(); | ||
|
|
||
| const firstRenderRef = useRef(true); | ||
|
|
||
| const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportIDFromRoute}`, {allowStaleData: true, canBeMissing: true}); | ||
| const prevReport = usePrevious(report); | ||
|
|
||
| const isFocused = useIsFocused(); | ||
|
|
||
| // Dismiss modal when the money request report is removed (e.g. deleted or merged). | ||
| useEffect(() => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This introduced #89177. The report-removal detection effect watches |
||
| // Skip first run so we don't dismiss on mount when report may still be loading. | ||
| if (firstRenderRef.current) { | ||
| firstRenderRef.current = false; | ||
| return; | ||
| } | ||
|
|
||
| // Report is gone now but we had a money request report before → it was removed. | ||
| const isRemovalExpectedForReportType = !report && isMoneyRequestReport(prevReport); | ||
|
|
||
| if (isRemovalExpectedForReportType) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you leave a comment explaining why this is necessary? For whoever is looking at this code later
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @paulnjs Friendly bump!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pecanoro Oh, thanks for reminding me! I updated. |
||
| if (!isFocused) { | ||
| return; | ||
| } | ||
| Navigation.dismissModal(); | ||
| } | ||
| }, [report]); | ||
|
|
||
| useEffect(() => { | ||
| // Update last visit time when the expense super wide RHP report is focused | ||
| if (!reportIDFromRoute || !isFocused || route.name !== SCREENS.RIGHT_MODAL.EXPENSE_REPORT) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.