-
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
Handle hold unhold search #49605
Handle hold unhold search #49605
Conversation
b063987
to
2f327ae
Compare
This approach works well. I’m resolving the TypeScript error and will share videos shortly. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-app-2024-09-19_11.31.26.mp4Android: mWeb Chromeandroid-chrome-2024-09-19_11.36.50.mp4iOS: Nativeios-app-2024-09-19_13.44.16.mp4iOS: mWeb Safariios-safari-2024-09-19_13.50.09.mp4MacOS: Chrome / Safaridesktop-chrome-2024-09-19_10.57.05.mp4MacOS: Desktopdesktop-chrome-2024-09-18_12.15.55.mp4 |
Co-authored-by: Joel Davies <joeld.dev@gmail.com>
@jjcoffee, could you look into the TypeScript error? I’m having some difficulty with it. |
@cretadn22 Hmm could you try asking on Slack? |
@cretadn22 The type error occurs because TypeScript cannot reconcile your provided object with the expected type due to conflicting index signatures. Specifically, you're assigning an object with a generic string index signature ProblemThe App/src/types/onyx/SearchResults.ts Lines 272 to 275 in d73a3bf
When you try to assign a value to SolutionTo fix the type error, you need to ensure that your data object matches the expected index signatures. Here's how you can adjust your code:
Create a new type that represents a partial version of the transactions data, ensuring that the index signatures are compatible. type PartialTransactionsData = Partial<{
[key: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: Partial<SearchTransaction>;
}>;
Adjust your optimisticData.push call to use the PartialTransactionsData type for the data property. optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${searchHash}`,
value: {
data: {
[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {
canHold: true,
canUnhold: false,
},
} as PartialTransactionsData,
},
}); Note: Apply the same typing to all 4 objects where you get the type error. Explanation
Credits: ChatGPT o1-preview |
canUnhold: true, | ||
}, | ||
}, | ||
} as Record<string, Record<string, Partial<SearchTransaction>>>, |
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.
Using the same type
App/src/libs/actions/Search.ts
Line 84 in a373b27
const onyxUpdate: Record<string, Record<string, Partial<SearchTransaction>>> = { |
@ikevin127 Thanks so much for your help |
@jjcoffee Back to you |
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!
Just to note that a separate issue should be opened for the bulk action dropdown not updating, i.e. following these steps:
|
Created issue here |
✋ 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/luacmartins in version: 9.0.41-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.41-10 🚀
|
Details
Fixed Issues
$ #46524
PROPOSAL: #46524 (comment)
Tests
QA Steps
Offline tests
QA Steps
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
6.mov
Android: mWeb Chrome
5.mov
iOS: Native
4.mov
iOS: mWeb Safari
3.mov
MacOS: Chrome / Safari
2.1.mp4
MacOS: Desktop
1.mov