Skip to content

fix(ios): stop empty-state flash during data browser reload#1223

Merged
datlechin merged 1 commit into
mainfrom
fix/ios-databrowser-empty-state-flash
May 11, 2026
Merged

fix(ios): stop empty-state flash during data browser reload#1223
datlechin merged 1 commit into
mainfrom
fix/ios-databrowser-empty-state-flash

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Two related iOS data browser bugs reported via TestFlight (iPhone 17 Pro / iOS 26.4.2) and reproduced locally:

  1. Clear the search field on a PostgreSQL table → "No Data" empty state shows briefly instead of returning to the row list.
  2. Any reload that follows a sort, filter, or page-size change flashes "No Data" between clearing the previous rows and the new rows streaming in.

Root cause

DataBrowserViewModel.load() only set isLoading = true when legacyRows.isEmpty || isInitial. The downstream loadPage() then unconditionally calls legacyRows.removeAll() before streaming begins. For any reload that started with rows on screen (i.e., sort, filter, search, clear-search), legacyRows became empty mid-flight while both loading flags read false. The view's if rows.isEmpty branch fired in that window and rendered the "No Data" empty state, which then got replaced when rows arrived.

navigatePage() set isPageLoading manually around its load() call, but the other entry points (applySort, applyFilters, clearFilters, applySearch, clearSearch) did not.

Fix

  • load() now owns both loading flags. If isInitial || legacyRows.isEmpty it sets isLoading = true (full-screen spinner); otherwise it sets isPageLoading = true (in-list overlay that keeps the existing rows visible until they get replaced). Both flags reset on every exit path.
  • navigatePage() no longer touches isPageLoading since load() handles it.
  • DataBrowserView.content gets one new branch: rows.isEmpty && isPageLoading shows a ProgressView instead of falling through to the empty state.
  • Bottom toolbar visibility includes !viewModel.isPageLoading so it stops flickering when an interaction clears rows.

Test plan

  • Search on a PostgreSQL table, clear the search field → row list returns directly with no "No Data" flash
  • Apply a filter, then clear it → list reloads without empty-state flash
  • Change sort column, change page size → in-list overlay shows, no empty state
  • Open a genuinely empty table → "No Data" with Insert Row action still shows
  • Search with zero matches → ContentUnavailableView.search still shows
  • DataBrowserViewModelTests/clearSearchReplacesRowsCleanly passes

@datlechin datlechin merged commit 4338609 into main May 11, 2026
3 checks passed
@datlechin datlechin deleted the fix/ios-databrowser-empty-state-flash branch May 11, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant