[CP STaging] Add a null safety for searchResults.search#96918
Conversation
|
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
| }).primaryHash | ||
| ); | ||
| const queryJSONHash = | ||
| queryJSON && searchResults?.search |
There was a problem hiding this comment.
@JS00001 @aimane-chnaif we have a crash report on Sentry because of undefined searchResults.search. It happens on staging for now, reproduced by QA, but I can't reproduce it. The type for search is also not undefined; that's why I removed the null safety before. I added it back now.
I still added QA steps to open the search page since QA can reproduce it.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f0f8ba052
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| }).primaryHash | ||
| : queryJSON?.hash; | ||
|
|
||
| return (searchResults?.data != null || searchResults?.errors != null) && searchResults.search?.type === queryJSON?.type && searchResults.search?.hash === queryJSONHash; |
There was a problem hiding this comment.
Handle data-only snapshots as loaded
When a chat message or task is created while offline, buildOptimisticSnapshotData() is used from Task.ts/Report/index.ts to populate the canned Reports > Chats/Task snapshot with data only, so there is intentionally no search object on that snapshot. With this guard, isSearchDataLoaded() returns false whenever searchResults.search is missing, so useSearchSnapshot never computes sections and the Search screen falls through to EmptySearchView even though the optimistic offline rows are present. Please either write the missing search metadata for those snapshots or treat a data-only snapshot for the current query hash/type as loaded instead of requiring searchResults.search.
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
🤖 Review: LGTM — the change is a correct, minimal null-safety fix and all checks pass. The crash came from unconditionally reading One nice detail: the Verification
Checks: all green (typecheck, ESLint, unit |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
🚧 JS00001 has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
Should we CP this? |
|
Requested a CP |
…esults-search Add a null safety for searchResults.search (cherry picked from commit 2719a19) (cherry-picked to staging by Beamanator)
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.4.44-1 🚀
|
|
🤖 I reviewed the changes in this PR and no help site changes are required. Why: This PR adds null safety to No draft PR was created. |
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.4.44-1 🚀
|

Explanation of Change
Fixed Issues
$ #96074
PROPOSAL:
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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