Repository navigation
Clear delete navigate back URL when the deleted expense screen unmounts #105220
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
Open
David-2002065
wants to merge
12
commits into
Expensify:main
Choose a base branch
from
David-2002065:fix/103403-clear-delete-url-native
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+374
−21
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
13048d9
Clear delete navigate back URL when the deleted expense screen unmounts
David-2002065 8f27a00
Mock clearDeleteTransactionNavigateBackUrlAfterTransitions in SearchM…
David-2002065 349b726
Cancel a pending delete URL clear when a newer deletion sets the URL
David-2002065 67b98ba
Document the unmount clear in SearchMoneyRequestReportPage
David-2002065 8859381
Only clear the delete navigate back URL on unmount for transaction th…
David-2002065 592cf6b
Move the delete URL read out of the action into a hook
David-2002065 5fa19e0
Merge remote-tracking branch 'upstream/main' into fix/103403-clear-de…
David-2002065 0124f66
Merge remote-tracking branch 'upstream/main' into fix/103403-clear-de…
David-2002065 a6171a7
Move the delete navigate back URL to a RAM_ONLY key with a clearer name
David-2002065 fc6be12
Merge remote-tracking branch 'upstream/main' into fix/103403-clear-de…
David-2002065 6e8abda
Use connection.unsubscribe in the delete navigate back handler test
David-2002065 7042e80
Recheck the transaction thread when parent data loads and cancel the …
David-2002065 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/hooks/useClearDeleteTransactionNavigateBackUrlOnUnmount.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import {doesDeleteNavigateBackUrlIncludeDuplicatesReview} from '@libs/TransactionNavigationUtils'; | ||
|
|
||
| import {clearDeleteTransactionNavigateBackUrlAfterTransitions} from '@userActions/Report'; | ||
|
|
||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
||
| import {useEffect} from 'react'; | ||
| import Onyx from 'react-native-onyx'; | ||
|
|
||
| /** Clears the delete navigate back URL on unmount, since native stack never renders a popped screen unfocused. */ | ||
| function useClearDeleteTransactionNavigateBackUrlOnUnmount(shouldClear: boolean) { | ||
| useEffect(() => { | ||
| if (!shouldClear) { | ||
| return; | ||
| } | ||
| return () => | ||
| clearDeleteTransactionNavigateBackUrlAfterTransitions(() => | ||
| // Read when the clear fires, the unmounted screen may never have received the URL. | ||
| Onyx.get(ONYXKEYS.RAM_ONLY_PENDING_TRANSACTION_DELETE_URL).then((url) => !!url && !doesDeleteNavigateBackUrlIncludeDuplicatesReview(url)), | ||
| ); | ||
| }, [shouldClear]); | ||
| } | ||
|
|
||
| export default useClearDeleteTransactionNavigateBackUrlOnUnmount; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.