-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[Better Expense Report View] Fix RBR logic & a few follow-ups #60819
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
Merged
mountiny
merged 14 commits into
Expensify:main
from
software-mansion-labs:korytko/rbr-and-followups
Apr 30, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3b3a95d
Increase maximum RBR message size
JakubKorytko 194a757
Add docs & refractor report screen hook
JakubKorytko 08ef9a3
Remove connectedIntegration check
JakubKorytko 4e4a9ae
Merge branch 'main' into korytko/rbr-and-followups
JakubKorytko bfed673
Merge branch 'main' into korytko/rbr-and-followups
JakubKorytko df41218
Merge branch 'main' into korytko/rbr-and-followups
JakubKorytko c8a21e7
Extract violation message path method to utils
JakubKorytko 64ab66d
Fix eslint errors
JakubKorytko dfb835a
Add RBR_MESSAGE_MAX_CHARACTERS constraint
JakubKorytko 1dbdd59
Increase RBR_MESSAGE_MAX_CHARACTERS to 40
JakubKorytko 514507e
Merge branch 'main' into korytko/rbr-and-followups
JakubKorytko b203e53
Merge branch 'main' into korytko/rbr-and-followups
JakubKorytko cb40e3a
Address Vit PR comments
JakubKorytko 5915e65
Merge branch 'main' into korytko/rbr-and-followups
JakubKorytko 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import {useNavigation} from '@react-navigation/native'; | ||
| import {useCallback, useEffect, useRef} from 'react'; | ||
| import Navigation from '@navigation/Navigation'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| /** | ||
| * Hook that returns a function to check if the currently active route remains the same as the last known route. | ||
| * The last known route reference is updated every time the component experiences a 'blur' event, | ||
| * except when opening an attachments modal, which is treated as an exception and does not trigger a reference update. | ||
| * | ||
| * @return Function that checks if the last known route matches the currently active route. | ||
| */ | ||
| function useCheckIfRouteHasRemainedUnchanged(): () => boolean { | ||
| const lastKnownRouteRef = useRef<string | undefined>(undefined); | ||
| const navigation = useNavigation(); | ||
|
|
||
| // Function to compare the last known route with the current active route | ||
| const hasRouteRemainedUnchanged = useCallback(() => { | ||
| return lastKnownRouteRef.current === Navigation.getActiveRouteWithoutParams(); | ||
| }, []); | ||
|
|
||
| // Initialize the initial route when navigation is ready | ||
| useEffect(() => { | ||
| Navigation.isNavigationReady().then(() => { | ||
| if (lastKnownRouteRef.current !== undefined) { | ||
| return; | ||
| } | ||
|
|
||
| lastKnownRouteRef.current = Navigation.getActiveRouteWithoutParams(); | ||
| }); | ||
| }, []); | ||
|
|
||
| // Update the route reference on 'blur' events, except when opening attachments modal | ||
| useEffect(() => { | ||
| return navigation.addListener('blur', () => { | ||
| const currentRoute = Navigation.getActiveRouteWithoutParams(); | ||
| if (currentRoute === `/${ROUTES.ATTACHMENTS.route}`) { | ||
| // Skip route update when attachment modal is opened | ||
| return; | ||
| } | ||
| lastKnownRouteRef.current = currentRoute; | ||
| }); | ||
| }, [navigation]); | ||
|
|
||
| return hasRouteRemainedUnchanged; | ||
| } | ||
|
|
||
| export default useCheckIfRouteHasRemainedUnchanged; |
This file was deleted.
Oops, something went wrong.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we forgot a case, on how we should filter the violations more information here: #65477 (comment)