-
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
fix: allow user to instantly edit created distance rate #38799
fix: allow user to instantly edit created distance rate #38799
Conversation
@@ -179,10 +179,12 @@ function PolicyDistanceRatesPage({policy, route}: PolicyDistanceRatesPageProps) | |||
}; | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor fix to toggleAllRates functionality. It wasn't working properly in offline mode
If we don't provide the |
src/libs/PolicyDistanceRatesUtils.ts
Outdated
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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
✋ 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
create-edge-case-fix.mp4
MacOS: Desktop