-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add toggle for enable/disable instead of label #55192
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 |
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.
LGTM.
if (!customUnitID) { | ||
return; | ||
} | ||
|
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 🚀
|
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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