Display SearchForReports results in Auth's tier order#94362
Display SearchForReports results in Auth's tier order#94362carlosmiceli wants to merge 5 commits into
Conversation
|
@codex review |
|
@MelvinBot fix eslint |
Co-authored-by: Carlos Miceli <carlosmiceli@users.noreply.github.com>
|
🤖 Fixed the failing ESLint check. The error was an unnecessary type assertion in Verified locally with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c2c1d4039
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // When the server has returned a tier-ranked order for this search, display results in that order | ||
| // instead of the client-side kind/recency order. Reports absent from the list sort to the end. | ||
| if (searchResultReportIDs && searchResultReportIDs.length > 0) { |
There was a problem hiding this comment.
Clear stale server order on new searches
This applies any non-empty RAM_ONLY_SEARCH_RESULT_REPORT_IDS to every non-empty autocomplete query, but the new RAM-only key is global and is not cleared when autocompleteQueryValue changes or when a new SearchForReports starts/fails. After one Cmd+K search receives an Auth order, typing a different query (or searching while offline/failing before a new response arrives) reuses the previous query's IDs, incorrectly reordering overlapping reports and switching the UI into the single "Search results" section before the current query has a server order. The order needs to be tied to the active query or cleared before starting/aborting a new search.
Useful? React with 👍 / 👎.
Explanation of Change
NewDot's chat-finder builds its result order entirely client-side (report kind + recency) and never read the order Auth returns for
SearchForReports, so the backend's tier ranking (self → primary workspace → primary domain → other shared workspaces → everyone else) was discarded.With the backend now sending an ordered
searchResultReportIDslist (companion Web-E PR), this:RAM_ONLY_SEARCH_RESULT_REPORT_IDSOnyx key for that list.#adminswere pushed to the bottom by the client kind-sort even though Auth ranks them near the top. The cache is still used for instant display; the list only visibly reorders when the cached order disagrees with Auth (a no-op when they already match).Companion PRs:
Note: this changes the two-section "stable chat switcher" behavior (
claude-stableTwoSectionChatSwitcherV2) when a server order is present — flagging for that area's reviewers.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/530969
PROPOSAL:
Tests
#admins), then same-domain DMs, then other-workspace chats — not by recency, and rooms are not pushed to the bottom.Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiongetValidOptions/search options used elsewhere (mentions, share, search filters)