Make WorkspaceCategoriesSettingsPage use new SelectionList#72315
Conversation
Codecov Report❌ Patch coverage is
... and 15 files with indirect coverage changes 🚀 New features to boost your workflow:
|
zfurtak
left a comment
There was a problem hiding this comment.
LGTM, just left some thoughts ✨
| }; | ||
|
|
||
| type ValidListItem = typeof RadioListItem; | ||
| type ValidListItem = typeof RadioListItem | typeof BaseListItem | typeof MultiSelectListItem | typeof SingleSelectListItem | typeof SpendCategorySelectorListItem; |
| const isToggleDisabled = !policy?.areCategoriesEnabled || !hasEnabledCategories || isConnectedToAccounting; | ||
|
|
||
| const setNewCategory = (selectedCategory: ListItem) => { | ||
| if (!selectedCategory.keyForList || !groupID) { |
There was a problem hiding this comment.
Why this check is not needed anymore? What happen if groupID is not set initially? 🤔
There was a problem hiding this comment.
Instead I added currentGroupID prop to the setNewCategory function, because looking at the logic, the only usage of this function will have groupID defined:
{!!categoryID && !!groupID && (
<CategorySelectorModal
...
onCategorySelected={(selectedCategory) => setNewCategory(selectedCategory, groupID)}
...
/>| customListHeaderContent={ | ||
| <View style={[styles.mh5, styles.mt2, styles.mb1]}> | ||
| <Text style={[styles.headerText]}>{translate('workspace.categories.defaultSpendCategories')}</Text> | ||
| <Text style={[styles.mt1, styles.lh20]}>{translate('workspace.categories.spendCategoriesDescription')}</Text> | ||
| </View> | ||
| } |
There was a problem hiding this comment.
What do you think about moving this code above return?
There was a problem hiding this comment.
I think in this case it's more of a preference, I tried to find style guidelines for this kind of situations for this project but I couldn't. I moved it above return as well as onSelectRow handler anyway.
|
@rushatgabhane 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] |
| }); | ||
| }; | ||
|
|
||
| const onSelectItem = (item: ListItem) => { |
There was a problem hiding this comment.
let's wrap it into useCallback
| setGroupID(item.groupID); | ||
| }; | ||
|
|
||
| const selectionListHeaderContent = ( |
There was a problem hiding this comment.
let's wrap it into useMemo
There was a problem hiding this comment.
Is it really necessary to wrap these into useMemo and useCallback? I played a bit with the Profiler and it doesn't show any rerenders of SelectionList caused by onSelectRow and customListHeaderContent when I'm using the list. It looks like React Compiler takes care of the memoization here to prevent unnecessary re-renders. What do you think?
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-10-22.at.09.35.11.movAndroid: mWeb ChromeScreen.Recording.2025-10-22.at.09.33.13.moviOS: HybridAppScreen.Recording.2025-10-22.at.09.35.45.moviOS: mWeb SafariScreen.Recording.2025-10-22.at.09.31.41.movMacOS: Chrome / SafariScreen.Recording.2025-10-22.at.09.29.26.movMacOS: DesktopScreen.Recording.2025-10-22.at.09.37.47.mov |
|
@GCyganek We got the conflict. |
…sPage-SelectionList
|
✋ 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/grgia in version: 9.2.38-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.2.38-5 🚀
|
Explanation of Change
Fixed Issues
$ #65655
PROPOSAL: N/A
Tests
Categoriesscreen in your workspaceMoreat the top right cornerSettingsto open the listOffline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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.2025-10-10.at.14.11.38.mov
Android: mWeb Chrome
Screen.Recording.2025-10-10.at.14.16.48.mov
iOS: Native
Screen.Recording.2025-10-10.at.14.22.07.mov
iOS: mWeb Safari
Screen.Recording.2025-10-10.at.14.22.49.mov
MacOS: Chrome / Safari
Screen.Recording.2025-10-10.at.14.08.12.mov
MacOS: Desktop
Screen.Recording.2025-10-10.at.14.13.12.mov