You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Reports - Workspace filter results shows blank space in the middle of the page. #83991
Version Number: V9.3.28-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#81883 Email or phone of affected tester (no customers):dreamnitethedragon@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Redminote 10S Android 13 App Component: User Settings
Action Performed:
Launch app
Create 2 Workspaces
Create 5 expense in first workspace and 1 expense in second workspace
Go to reports - filter - select workspace 1 and save search the results
Delete the saved search
Tap filter and select the same workspace and view results
Expected Result:
Workspace filter results must not show blank space in the middle of the page.
Actual Result:
Workspace filter results shows blank space in the middle of the page.
Please re-state the problem that we are trying to solve in this issue.
When filtering reports by workspace and then repeating the filter after deleting a saved search, blank spaces appear in the middle of the results list. Items that should be gone are still occupying vertical space on screen.
What is the root cause of that problem?
Items with a pendingAction === 'delete' are passed into the sorted/rendered list but their content is hidden by OfflineWithFeedback. When hideChildren is true (online + DELETE pending + no errors), OfflineWithFeedback suppresses rendering the inner content but still returns its outer <View style={style}> wrapper — leaving behind a blank space the exact height of a list row.
The check that computes visibleDataLength (to decide whether to show the empty state) correctly excludes DELETE-pending items:
But that filtered count is only used for the empty-state guard. The items themselves are never filtered out of filteredData / sortedData before they are passed to the list — so they render as invisible rows with full height.
What changes do you think we should make in order to solve the problem?
Filter out DELETE-pending items from filteredData before they reach sortedData and the selection list. The right place is the filteredData memo (or immediately before sortedData is derived). Since isOffline should still let them show (for offline feedback UX), the same guard used elsewhere in the codebase applies: item.pendingAction !== DELETE || isOffline.
The same one-line filter should be applied to the non-grouped branch. This mirrors the existing pattern on line 1248 and ensures blank rows are never passed to the list renderer regardless of grouping mode.
What alternative solutions did you explore? (Optional)
An alternative would be to pass shouldHideOnDelete={false} through BaseListItem so that OfflineWithFeedback renders nothing (not even the outer View) when hiding — but that would require threading a new prop through several layers and could break offline strikethrough UX. Filtering at the data level before rendering is simpler and consistent with how the empty-state check already works.
Please re-state the problem that we are trying to solve in this issue.
After creating a saved search with a workspace filter, deleting that saved search, and then re-applying the same workspace filter, blank space appears in the middle of the search results page.
What is the root cause of that problem?
The root cause is that deleteSavedSearch() only cleans up ONYXKEYS.SAVED_SEARCHES but never invalidates the search result snapshot at ONYXKEYS.COLLECTION.SNAPSHOT${hash}. Since the same workspace filter deterministically produces the same query hash, re-applying the filter reads the stale snapshot immediately from Onyx instead of showing a loading skeleton.
Here's the specific chain of events:
User saves a search filtered by workspace 1 → results stored in snapshot_<H> (where H is the hash of the query)
User deletes the saved search → deleteSavedSearch(H) only sets SAVED_SEARCHES[H] to null (Search.ts:364-398) — the snapshot at COLLECTION.SNAPSHOT${H} is left untouched
Deleting the saved search causes shouldCalculateTotals to flip from true to false (useSearchShouldCalculateTotals.ts:32) since isSavedSearch becomes false
User re-applies the same workspace filter → same hash H is computed (deterministic hashing at SearchQueryUtils.ts:340-394)
SearchContext reads COLLECTION.SNAPSHOT${H} via useOnyx → gets stale snapshot data immediately (SearchContext.tsx:88)
isSearchDataLoaded returns true because the stale snapshot's type/status match the current query (SearchUIUtils.ts:3809-3819)
The loading skeleton is not shown because shouldShowLoadingState requires data.length === 0 for an empty array, but the stale snapshot has data as a non-empty object (Search/index.tsx:399-405)
Meanwhile, a new search API call triggers getOnyxLoadingData which uses Onyx.METHOD.MERGE to set isLoading: true — but never clears the data field (Search.ts:269-288)
Additionally, shouldClearTotals is now true (from PR Fix stale Search footer totals by clearing count metadata on initial non-total fetch #81883's changes), so count: null, total: null, currency: null are merged into the snapshot metadata. Onyx's removeNestedNullValues removes these keys, creating an inconsistent state where the snapshot has data but no metadata
The stale snapshot data, combined with potentially outdated metadata, is rendered by getSections / getTransactionsSections — and items whose underlying Onyx data (transactions/reports) has changed since the snapshot was created may render as empty rows or produce layout gaps in the FlashList
The codebase already acknowledges this race condition in a comment: "There's a race condition in Onyx which makes it return data from the previous Search" (Search/index.tsx:392-394), but the guard only checks type/status — which pass for the same filter.
What changes do you think we should make in order to solve the problem?
The fix should ensure that when a saved search is deleted and the same filter is re-applied, the stale snapshot doesn't cause rendering issues. There are two approaches:
Option A (Recommended — clear snapshot on search re-trigger): In getOnyxLoadingData (Search.ts:260-319), when offset === 0 (indicating a fresh search, not pagination), use Onyx.METHOD.SET instead of Onyx.METHOD.MERGE for the snapshot, or explicitly clear the data field. This ensures that when a fresh search is triggered, stale data is cleared and the loading skeleton is shown until fresh results arrive.
Option B (Targeted — clear snapshot on saved search deletion): In deleteSavedSearch (Search.ts:364-398), add optimistic data to clear the corresponding snapshot at ONYXKEYS.COLLECTION.SNAPSHOT${hash} (set it to null or clear its data field). This specifically handles the delete-then-refilter scenario.
Option A is preferable because it addresses the broader issue of stale snapshots being rendered whenever the same hash is reused, not just after saved search deletion.
What alternative solutions did you explore? (Optional)
Modifying isSearchDataLoaded to track freshness: Adding a timestamp or version counter to snapshots could detect staleness, but this adds complexity and doesn't address the core problem of stale data being rendered.
Clearing all snapshots on navigation: Too aggressive — would lose valid cached data for other searches.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
changed the title [-]Reports - Workspace filter results shows blank space in the middle of the page.[/-][+][$250] Reports - Workspace filter results shows blank space in the middle of the page.[/+]on Mar 3, 2026
When the user deletes a saved search and re-applies the same workspace filter, the same query hash is computed deterministically. The SearchContext reads the stale snapshot via useOnyx and returns it immediately.
isSearchDataLoaded returns true because the stale snapshot's type/status match the current query. getOnyxLoadingData uses Onyx.METHOD.MERGE and never clears the data field, so the old snapshot data is rendered and produces blank rows or layout gaps in the list.
What changes do you think we should make in order to solve the problem?
In getOnyxLoadingData, when offset === 0 or offset === undefined (fresh search, not pagination) and isSearchAPI is true, explicitly set data: [] in the optimistic update so stale snapshot data is cleared before the new API request. This ensures the loading skeleton is shown until fresh results arrive.
What alternative solutions did you explore? (Optional)
N/A
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Activity
melvin-bot commentedon Mar 3, 2026
Triggered auto assignment to @brianlee-expensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.MobileMage commentedon Mar 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When filtering reports by workspace and then repeating the filter after deleting a saved search, blank spaces appear in the middle of the results list. Items that should be gone are still occupying vertical space on screen.
What is the root cause of that problem?
Items with a
pendingAction === 'delete'are passed into the sorted/rendered list but their content is hidden byOfflineWithFeedback. WhenhideChildrenis true (online + DELETE pending + no errors),OfflineWithFeedbacksuppresses rendering the inner content but still returns its outer<View style={style}>wrapper — leaving behind a blank space the exact height of a list row.The check that computes
visibleDataLength(to decide whether to show the empty state) correctly excludes DELETE-pending items:App/src/components/Search/index.tsx
Lines 1248 to 1249 in 4f6bfe2
But that filtered count is only used for the empty-state guard. The items themselves are never filtered out of
filteredData/sortedDatabefore they are passed to the list — so they render as invisible rows with full height.What changes do you think we should make in order to solve the problem?
Filter out DELETE-pending items from
filteredDatabefore they reachsortedDataand the selection list. The right place is thefilteredDatamemo (or immediately beforesortedDatais derived). SinceisOfflineshould still let them show (for offline feedback UX), the same guard used elsewhere in the codebase applies:item.pendingAction !== DELETE || isOffline.App/src/components/Search/index.tsx
Lines 481 to 523 in 4f6bfe2
const filteredData = useMemo(() => { if (!validGroupBy || isExpenseReportType) { - return baseFilteredData; + return baseFilteredData.filter( + (item) => item.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline, + ); } const enriched = (baseFilteredData as TransactionGroupListItemType[]).map((item) => {The same one-line filter should be applied to the non-grouped branch. This mirrors the existing pattern on line 1248 and ensures blank rows are never passed to the list renderer regardless of grouping mode.
What alternative solutions did you explore? (Optional)
An alternative would be to pass
shouldHideOnDelete={false}throughBaseListItemso thatOfflineWithFeedbackrenders nothing (not even the outer View) when hiding — but that would require threading a new prop through several layers and could break offline strikethrough UX. Filtering at the data level before rendering is simpler and consistent with how the empty-state check already works.MelvinBot commentedon Mar 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After creating a saved search with a workspace filter, deleting that saved search, and then re-applying the same workspace filter, blank space appears in the middle of the search results page.
What is the root cause of that problem?
The root cause is that
deleteSavedSearch()only cleans upONYXKEYS.SAVED_SEARCHESbut never invalidates the search result snapshot atONYXKEYS.COLLECTION.SNAPSHOT${hash}. Since the same workspace filter deterministically produces the same query hash, re-applying the filter reads the stale snapshot immediately from Onyx instead of showing a loading skeleton.Here's the specific chain of events:
snapshot_<H>(whereHis the hash of the query)deleteSavedSearch(H)only setsSAVED_SEARCHES[H]tonull(Search.ts:364-398) — the snapshot atCOLLECTION.SNAPSHOT${H}is left untoucheduseDeleteSavedSearch.tsx:31-35shouldCalculateTotalsto flip fromtruetofalse(useSearchShouldCalculateTotals.ts:32) sinceisSavedSearchbecomes falseHis computed (deterministic hashing atSearchQueryUtils.ts:340-394)SearchContextreadsCOLLECTION.SNAPSHOT${H}viauseOnyx→ gets stale snapshot data immediately (SearchContext.tsx:88)isSearchDataLoadedreturnstruebecause the stale snapshot's type/status match the current query (SearchUIUtils.ts:3809-3819)shouldShowLoadingStaterequiresdata.length === 0for an empty array, but the stale snapshot has data as a non-empty object (Search/index.tsx:399-405)getOnyxLoadingDatawhich usesOnyx.METHOD.MERGEto setisLoading: true— but never clears thedatafield (Search.ts:269-288)shouldClearTotalsis nowtrue(from PR Fix stale Search footer totals by clearing count metadata on initial non-total fetch #81883's changes), socount: null, total: null, currency: nullare merged into the snapshot metadata. Onyx'sremoveNestedNullValuesremoves these keys, creating an inconsistent state where the snapshot has data but no metadatagetSections/getTransactionsSections— and items whose underlying Onyx data (transactions/reports) has changed since the snapshot was created may render as empty rows or produce layout gaps in the FlashListThe codebase already acknowledges this race condition in a comment: "There's a race condition in Onyx which makes it return data from the previous Search" (
Search/index.tsx:392-394), but the guard only checks type/status — which pass for the same filter.What changes do you think we should make in order to solve the problem?
The fix should ensure that when a saved search is deleted and the same filter is re-applied, the stale snapshot doesn't cause rendering issues. There are two approaches:
Option A (Recommended — clear snapshot on search re-trigger): In
getOnyxLoadingData(Search.ts:260-319), whenoffset === 0(indicating a fresh search, not pagination), useOnyx.METHOD.SETinstead ofOnyx.METHOD.MERGEfor the snapshot, or explicitly clear thedatafield. This ensures that when a fresh search is triggered, stale data is cleared and the loading skeleton is shown until fresh results arrive.Option B (Targeted — clear snapshot on saved search deletion): In
deleteSavedSearch(Search.ts:364-398), add optimistic data to clear the corresponding snapshot atONYXKEYS.COLLECTION.SNAPSHOT${hash}(set it tonullor clear itsdatafield). This specifically handles the delete-then-refilter scenario.Option A is preferable because it addresses the broader issue of stale snapshots being rendered whenever the same hash is reused, not just after saved search deletion.
What alternative solutions did you explore? (Optional)
isSearchDataLoadedto track freshness: Adding a timestamp or version counter to snapshots could detect staleness, but this adds complexity and doesn't address the core problem of stale data being rendered.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Mar 3, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 (
External)[-]Reports - Workspace filter results shows blank space in the middle of the page.[/-][+][$250] Reports - Workspace filter results shows blank space in the middle of the page.[/+]melvin-bot commentedon Mar 3, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022028727399074439102
daledah commentedon Mar 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace filter results shows blank space in the middle of the page.
What is the root cause of that problem?
deleteSavedSearch()only cleans upONYXKEYS.SAVED_SEARCHESbut never invalidates the search result snapshot atONYXKEYS.COLLECTION.SNAPSHOT${hash}.App/src/libs/actions/Search.ts
Lines 366 to 398 in 4f6bfe2
When the user deletes a saved search and re-applies the same workspace filter, the same query hash is computed deterministically. The SearchContext reads the stale snapshot via
useOnyxand returns it immediately.App/src/components/Search/SearchContext.tsx
Line 88 in 4f6bfe2
isSearchDataLoaded returns true because the stale snapshot's type/status match the current query. getOnyxLoadingData uses
Onyx.METHOD.MERGEand never clears thedatafield, so the old snapshot data is rendered and produces blank rows or layout gaps in the list.App/src/libs/SearchUIUtils.ts
Lines 3809 to 3819 in 4f6bfe2
App/src/libs/actions/Search.ts
Lines 260 to 288 in 4f6bfe2
What changes do you think we should make in order to solve the problem?
In
getOnyxLoadingData, whenoffset === 0oroffset === undefined(fresh search, not pagination) andisSearchAPIis true, explicitly setdata: []in the optimistic update so stale snapshot data is cleared before the new API request. This ensures the loading skeleton is shown until fresh results arrive.What alternative solutions did you explore? (Optional)
N/A
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
dukenv0307 commentedon Mar 3, 2026
@MelvinBot @daledah It seems like the issue can be reproduced on Android Native only. Can you please explain why?
30 remaining items
melvin-bot commentedon Mar 31, 2026
@dukenv0307 @brianlee-expensify this issue is now 4 weeks old, please consider:
Thanks!
dukenv0307 commentedon Apr 1, 2026
@jponikarchuk can you please close it?
mvtglobally commentedon Apr 4, 2026
Issue not reproducible during KI retests. (Third week)
dukenv0307 commentedon Apr 6, 2026
@jponikarchuk kindly bump to close the issue
jponikarchuk commentedon Apr 6, 2026
@brianlee-expensify Could you please decide if this issue should be closed?
melvin-bot commentedon Apr 7, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Apr 9, 2026
@dukenv0307 Whoops! This issue is 2 days overdue. Let's get this updated quick!
brianlee-expensify commentedon Apr 9, 2026
closing out as issue is no longer reproducible