Repository navigation
Fix Chat - App returns to main chat after refreshing Flag as offensive RHP in thread #87622
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
mjasikowski
merged 7 commits into
Expensify:main
from
software-mansion-labs:collectioneur/fix-flag-comment-page-in-thread
Apr 13, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2f63977
fix screen underneath handling logic
collectioneur a85b7d8
fix prettier
collectioneur 1aa0aa5
make dynamic route checking more stable
collectioneur 9318619
fix comment
collectioneur 8516d9c
revert some unnecessary changes
collectioneur 083ce8e
Revert Mobile-Expensify submodule to main version
collectioneur a44f476
add tests
collectioneur 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
21 changes: 21 additions & 0 deletions
21
src/libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen.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,21 @@ | ||
| import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config'; | ||
| import type {DynamicRouteSuffix} from '@src/ROUTES'; | ||
| import type {Screen} from '@src/SCREENS'; | ||
| import {dynamicRoutePaths} from './isDynamicRouteSuffix'; | ||
|
|
||
| /** | ||
| * Checks if a screen name is a dynamic route screen | ||
| * @param screenName - The name of the screen to check. | ||
| * @returns True if the screen name is a dynamic route screen, false otherwise. | ||
| */ | ||
| function isDynamicRouteScreen(screenName: Screen): boolean { | ||
| const screenPath = normalizedConfigs[screenName]?.path; | ||
|
|
||
| if (!screenPath) { | ||
| return false; | ||
| } | ||
|
|
||
| return dynamicRoutePaths.has(screenPath as DynamicRouteSuffix); | ||
| } | ||
|
|
||
| export default isDynamicRouteScreen; | ||
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 |
|---|---|---|
|
|
@@ -10,8 +10,10 @@ import NAVIGATORS from '@src/NAVIGATORS'; | |
| import type {Route as RoutePath} from '@src/ROUTES'; | ||
| import ROUTES from '@src/ROUTES'; | ||
| import SCREENS from '@src/SCREENS'; | ||
| import type {Screen} from '@src/SCREENS'; | ||
| import findMatchingDynamicSuffix from './dynamicRoutesUtils/findMatchingDynamicSuffix'; | ||
| import getPathWithoutDynamicSuffix from './dynamicRoutesUtils/getPathWithoutDynamicSuffix'; | ||
| import isDynamicRouteScreen from './dynamicRoutesUtils/isDynamicRouteScreen'; | ||
| import findFocusedRouteWithOnyxTabGuard from './findFocusedRouteWithOnyxTabGuard'; | ||
| import getMatchingNewRoute from './getMatchingNewRoute'; | ||
| import getParamsFromRoute from './getParamsFromRoute'; | ||
|
|
@@ -54,8 +56,13 @@ function getSearchScreenNameForRoute(route: NavigationPartialRoute): string { | |
| } | ||
|
|
||
| function getMatchingFullScreenRoute(route: NavigationPartialRoute) { | ||
| const isDynamicScreen = isDynamicRouteScreen(route.name as Screen); | ||
|
|
||
| // Check for backTo param. One screen with different backTo value may need different screens visible under the overlay. | ||
| if (isRouteWithBackToParam(route)) { | ||
| // Dynamic screens are skipped here because they never carry their own backTo - they only | ||
| // inherit it from the screen underneath. Letting backTo dictate the full-screen route for | ||
| // a dynamic screen would resolve the wrong page. | ||
| if (isRouteWithBackToParam(route) && !isDynamicScreen) { | ||
|
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. and a test for this branch |
||
| const stateForBackTo = getStateFromPath(route.params.backTo as RoutePath); | ||
|
|
||
| // This may happen if the backTo url is invalid. | ||
|
|
||
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,41 @@ | ||
| import isDynamicRouteScreen from '@libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen'; | ||
| import type {Screen} from '@src/SCREENS'; | ||
| import SCREENS from '@src/SCREENS'; | ||
|
|
||
| describe('isDynamicRouteScreen', () => { | ||
| it('should return true for a static dynamic route screen (DYNAMIC_VERIFY_ACCOUNT)', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.SETTINGS.DYNAMIC_VERIFY_ACCOUNT)).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true for a multi-segment dynamic route screen (DYNAMIC_ADD_BANK_ACCOUNT_VERIFY_ACCOUNT)', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.SETTINGS.DYNAMIC_ADD_BANK_ACCOUNT_VERIFY_ACCOUNT)).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true for a parametric dynamic route screen (DYNAMIC_FLAG_COMMENT)', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.DYNAMIC_FLAG_COMMENT)).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true for DYNAMIC_KEYBOARD_SHORTCUTS', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.SETTINGS.DYNAMIC_KEYBOARD_SHORTCUTS)).toBe(true); | ||
| }); | ||
|
|
||
| it('should return true for DYNAMIC_ADDRESS_COUNTRY', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.SETTINGS.PROFILE.DYNAMIC_ADDRESS_COUNTRY)).toBe(true); | ||
| }); | ||
|
|
||
| it('should return false for a regular screen (HOME)', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.HOME)).toBe(false); | ||
| }); | ||
|
|
||
| it('should return false for a regular screen (REPORT)', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.REPORT)).toBe(false); | ||
| }); | ||
|
|
||
| it('should return false for a regular settings screen (Settings_Root)', () => { | ||
| expect(isDynamicRouteScreen(SCREENS.SETTINGS.ROOT)).toBe(false); | ||
| }); | ||
|
|
||
| it('should return false for a screen name not present in normalizedConfigs', () => { | ||
| expect(isDynamicRouteScreen('NonExistentScreen_12345' as Screen)).toBe(false); | ||
| }); | ||
| }); |
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.
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.
NAB: adding a test wouldn't hurt 😄