Not here error appears briefly when enabling features#40650
Not here error appears briefly when enabling features#40650puneetlath merged 12 commits intoExpensify:mainfrom
Conversation
|
@hungvu193 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@hungvu193 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.movAndroid: mWeb ChromemAndroid.moviOS: Nativeios.moviOS: mWeb SafarimSafari.movMacOS: Chrome / Safarichrome.movMacOS: Desktopdesk.mov |
|
For more context, the conversation from old PR is here: |
| if (!isFocused) { | ||
| return; |
There was a problem hiding this comment.
@ZhenjaHorbach Can you elaborate about this one?
This one will cause regression, because in some feature screens, we still have the modal screen, ie: CategoryDetail.
So if we opened CategoryDetail screen and disabled the category feature, we will only see the NotFoundScreen after we dismiss the modal.
There was a problem hiding this comment.
Evidence:
Screen.Recording.2024-04-22.at.14.36.09.mov
There was a problem hiding this comment.
Hm
Good catch
Actually I think we can remove this condition
Because it was one of the options to get rid of setTimeout from my previous implementation
But now I tested without this condition
And it seems to work well
There was a problem hiding this comment.
Still didn't work, please make sure you test it carefully.
Screen.Recording.2024-04-22.at.16.14.35.mov
There was a problem hiding this comment.
I mentioned few test cases already, please make sure it will test all these cases.
#39443 (comment)
There was a problem hiding this comment.
I made the video for all cases
zapis-ekrana-2024-04-22-v-114038_PvYQVrKb.mp4
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.4.66-0 🚀
|
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.4.66-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.66-5 🚀
|
aldo-expensify
left a comment
There was a problem hiding this comment.
Please avoid casts (as), it should be a last resource in exceptional cases, we have typescript because we want type safety and this breaks it.
| const policyFeatureStates = useMemo( | ||
| () => ({ | ||
| [CONST.POLICY.MORE_FEATURES.ARE_DISTANCE_RATES_ENABLED]: policy?.areDistanceRatesEnabled, | ||
| [CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED]: policy?.areWorkflowsEnabled, | ||
| [CONST.POLICY.MORE_FEATURES.ARE_CATEGORIES_ENABLED]: policy?.areCategoriesEnabled, | ||
| [CONST.POLICY.MORE_FEATURES.ARE_TAGS_ENABLED]: policy?.areTagsEnabled, | ||
| [CONST.POLICY.MORE_FEATURES.ARE_TAXES_ENABLED]: policy?.tax?.trackingEnabled, | ||
| [CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]: policy?.areConnectionsEnabled, | ||
| }), | ||
| [policy], | ||
| ) as PolicyFeatureStates; |
There was a problem hiding this comment.
There was a problem hiding this comment.
Oh, sorry, my fault
I agree that this is a mistake
| const newFeatureStates = {} as PolicyFeatureStates; | ||
| (Object.keys(policy?.pendingFields ?? {}) as PolicyFeatureName[]).forEach((key) => { |
There was a problem hiding this comment.
I think we should always avoid casting (as) since it breaks type safety. Was it really necessary?
There was a problem hiding this comment.
I think in this case it make sense
Because Object.keys always returns string[]
Which in this case breaks the typing inside the callback
| const theme = useTheme(); | ||
|
|
||
| const handleSwitchPress = () => { | ||
| InteractionManager.runAfterInteractions(() => { |
There was a problem hiding this comment.
Coming from issue #54767, The problem was that InteractionManager.runAfterInteractions caused the toggle to become unresponsive when a Lottie animation was present in the background.
We resolved the issue by replacing InteractionManager.runAfterInteractions with requestAnimationFrame.
Proposal: #54767 (comment)
PR: #55442
| useEffect(() => { | ||
| setFeatureStates((currentFeatureStates) => { | ||
| const newFeatureStates = {} as PolicyFeatureStates; | ||
| (Object.keys(policy?.pendingFields ?? {}) as PolicyFeatureName[]).forEach((key) => { |
There was a problem hiding this comment.
Not checking for whether the key exists in currentFeatureStates caused #74387

Details
Fixed Issues
$ #39443
PROPOSAL: #39443 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2024-04-14.at.23.35.34.mov
Android: mWeb Chrome
Screen.Recording.2024-04-14.at.23.35.34.mov
iOS: Native
Screen.Recording.2024-04-14.at.23.39.27.mov
iOS: mWeb Safari
Screen.Recording.2024-04-14.at.23.39.27.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-14.at.23.33.41.mov
MacOS: Desktop
Screen.Recording.2024-04-14.at.23.37.30.mov