Add toggle for enable/disable instead of label#55192
Conversation
|
@abzokhattab There is weird behaviour with the toggles. After I put the network back online, they don't respond properly. Additionally, when I scroll down the Category view and then click on a toggle, it doesn't respond. However, if I click on the next toggle, then both toggles change their state at the same time. The video below shows what's going on. Could you please check this and make sure everything works properly? Thanks. Screen.Recording.2025-01-17.at.13.25.14.mp4 |
…/disable-instead-of-label
i am not sure how to solve this issue but from what i notice its not that its not responding however its just abit heavy ... do you think this is still a bug and what could be the cause of that? Screen.Recording.2025-01-18.at.19.35.48.mov |
|
@abzokhattab It would still count as a bug since it is not behaving as the user expects, especially when interacting with the toggles after scrolling down. Try to create a Slack thread in #expensify-open-source asking if there are any tips or ideas on solving the problem. |
|
Please let us know when this is ready for a @Expensify/design review, thanks! |
|
cc @JmillsExpensify @trjExpensify for vis |
…/disable-instead-of-label
@abzokhattab - Did you happen to do this? This particular update is really critical and it would be great to move this forward with a bit more urgency. |
|
Posted here for discussion. |
|
We really need to keep this moving forward, please! |
61588d89-5342-4d1a-9a0f-aee19c26ebc5.MP4 |
…/disable-instead-of-label
|
Hey, I am not able to reproduce this. Can you please add reproduction steps? Regardless, looking at the diff --git a/src/libs/actions/Policy/Category.ts b/src/libs/actions/Policy/Category.ts
index 1b3267f5916..dcd37973af0 100644
--- a/src/libs/actions/Policy/Category.ts
+++ b/src/libs/actions/Policy/Category.ts
@@ -2,6 +2,7 @@ import lodashCloneDeep from 'lodash/cloneDeep';
import lodashUnion from 'lodash/union';
import type {NullishDeep, OnyxCollection, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
+import type {PartialDeep} from 'type-fest';
import * as API from '@libs/API';
import type {
EnablePolicyCategoriesParams,
@@ -215,7 +216,6 @@ function setWorkspaceCategoryEnabled(policyID: string, categoriesToUpdate: Recor
const optimisticPolicyCategoriesData = {
...Object.keys(categoriesToUpdate).reduce<PolicyCategories>((acc, key) => {
acc[key] = {
- ...policyCategories[key],
...categoriesToUpdate[key],
errors: null,
pendingFields: {
@@ -241,10 +241,8 @@ function setWorkspaceCategoryEnabled(policyID: string, categoriesToUpdate: Recor
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`,
value: {
- ...Object.keys(categoriesToUpdate).reduce<PolicyCategories>((acc, key) => {
+ ...Object.keys(categoriesToUpdate).reduce<PartialDeep<PolicyCategories>>((acc, key) => {
acc[key] = {
- ...policyCategories[key],
- ...categoriesToUpdate[key],
errors: null,
pendingFields: {
enabled: null,
@@ -265,7 +263,6 @@ function setWorkspaceCategoryEnabled(policyID: string, categoriesToUpdate: Recor
...Object.keys(categoriesToUpdate).reduce<PolicyCategories>((acc, key) => {
acc[key] = {
...policyCategories[key],
- ...categoriesToUpdate[key],
errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('workspace.categories.updateFailureMessage'),
pendingFields: {
enabled: null,Explanation:
|
|
Cant reproduce now, updating success data resolves all issues! |
Reviewer Checklist
Screenshots/VideosAndroid: NativeiOS: NativeMacOS: Chrome / Safari55192-web.mp4 |
| if (!customUnitID) { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
if this is true, do we catch this error in any way? Should we be calling clearDeleteDistanceRateError without customUnitID?
There was a problem hiding this comment.
I updated it to be required only and modified the dismissError function to check if the customUnitID is not undefined. Please review this commit:
c78e104
|
@abzokhattab There are some additional conflicts. Could you please resolve them? |
460c5d6 to
d27e7a9
Compare
…or and clearCreateDistanceRateItemAndError
…/disable-instead-of-label
|
@grgia Re-tested and confirmed working ok. All yours. |
|
✋ 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.0.93-0 🚀
|
|
@abzokhattab This PR is failing because of issue #56173
bug.mp4 |
|
It seems like this PR caused a regression: #56173 I'm not going to block deploy on it because it's minor, but can we please follow-up to fix this bug? |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.93-3 🚀
|
| errors: value.errors ?? undefined, | ||
| rightElement: <ListItemRightCaretWithLabel labelText={value.enabled ? translate('workspace.common.enabled') : translate('workspace.common.disabled')} />, | ||
| rightElement: ( | ||
| <Switch |
There was a problem hiding this comment.
Coming from #67934. We should've added a lock icon (via showLockIcon) here if it's the last enabled rate, to keep things consistent with categories and tags pages.



Explanation of Change
Fixed Issues
$ #55052
$ #53798
PROPOSAL: #53798 (comment)
Tests
Categories :
Taxes :
Distance Rates :
Tags :
Multilevel Tags :
Prerequisites:
Report Fields :
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)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-12-12.at.00.45.35.mov
Android: mWeb Chrome
Screen.Recording.2024-12-12.at.00.51.20.mov
iOS: Native
Screen.Recording.2024-12-12.at.00.45.35.mov
iOS: mWeb Safari
Screen.Recording.2024-12-12.at.00.51.20.mov
MacOS: Chrome / Safari
Categories:
Screen.Recording.2024-12-12.at.00.52.19.mov
Taxes:
taxes.mov
Distance Rates:
distance.mov
Screen.Recording.2025-01-14.at.04.07.06.mov
Tags:
tags-single.mov
Multilevel Tags:
tags-mult.mov
Report Fields:
report-fields.mov
MacOS: Desktop
Screen.Recording.2024-12-10.at.00.04.15.mov