fix: allow user to instantly edit created distance rate#38799
Conversation
|
|
||
| const toggleAllRates = () => { | ||
| if (selectedDistanceRates.length === Object.values(customUnitRates).length) { | ||
| const allSelectableRates = Object.values(customUnitRates).filter((rate) => rate.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); |
There was a problem hiding this comment.
minor fix to toggleAllRates functionality. It wasn't working properly in offline mode
|
If we don't provide the |
| * @param rates | ||
| */ | ||
| function getOptimisticRateName(rates: Record<string, Rate>): string { | ||
| const existingRatesWithSameName = Object.values(rates).filter((rate) => (rate.name ?? '').startsWith(CONST.CUSTOM_UNITS.DEFAULT_RATE)); |
There was a problem hiding this comment.
| const existingRatesWithSameName = Object.values(rates).filter((rate) => (rate.name ?? '').startsWith(CONST.CUSTOM_UNITS.DEFAULT_RATE)); | |
| const existingRatesWithSameName = Object.values(rates ?? {}).filter((rate) => (rate.name ?? '').startsWith(CONST.CUSTOM_UNITS.DEFAULT_RATE)); |
Same reason as other comment
|
Pressing as we do in RatePage and ValuePage
|
Reviewer Checklist
Screenshots/VideosAndroid: NativeinstantEditAndroid.mp4Android: mWeb ChromeinstantEditAndroidChrome.mp4iOS: NativeinstantEditiOS.mp4iOS: mWeb SafariinstantEditiOSSafari.mp4MacOS: Chrome / SafariinstantEditChrome.mp4MacOS: DesktopinstantEditDesktop.mp4 |
|
We might still end up giving same optimistic name for two rates. Say we made 25 rates. The last one will have name as I think backend is not adding increasing count of I think theses being rare cases we can just go ahead and merge. Or if we like to fix we can give unique keys for each rate name. cc: @luacmartins |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |


Details
Fixing the issue that prevented users from instantly editing freshly created distance rate.
Fixed Issues
$ #38798
$ #38815
PROPOSAL:
Tests
Same as QA steps
Offline tests
QA Steps
Precondition:
Have a paid policy that you're admin of
Enable distance rates
Verify that it is saved and is working as expected.
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
create-edge-case-fix.mp4
MacOS: Desktop