Skip to content

fix(tabs): keep a table tab's rows until you reload it - #3848

Merged
datlechin merged 2 commits into
mainfrom
fix/tab-switch-keeps-results
Oct 26, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/tab-switch-keeps-results

Conversation

@datlechin

@datlechin datlechin commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A table tab keeps the rows it last read until you reload it. Removed the two schedulers that dropped a background tab's rows and re-queried it when shown: the timer 5 s after the window (or a connection on the strip) lost key, and the per-switch RAM budget.
  • A tab whose table TablePro itself wrote to still reloads when shown, as the data grid docs describe (fix(tabs): reload only the tabs showing a changed table, never interrupt one holding edits, and read SQLite result columns after the first step #3148). This is the NSDocument model: a clean view follows its source.
  • The only memory a switch releases is the formatted text of unmounted grids. GridDisplayCacheBudget (RAM tier) replaces MemoryPressureAdvisor. The pressure halving is gone because dispatch/source.h says not to walk existing caches under pressure.
  • Background table tabs, including those of other databases on the strip, now hold their rows until they are reloaded or closed.
  • A load parked while disconnected is keyed by tab (ParkedTableLoad). On reconnect only that table tab loads, through the lazy-load gate. Before, a selected query tab got runQuery and ran the statement under its caret.
  • canAutoLoadTableTab and TableRowsRefreshPlan now share holdsUnsavedWork. A changed table no longer reloads under an open cell.
  • canEditActiveResult refuses edits while a claimed execution is replacing the tab's rows, as the data files grid does while busy. The result used to clear edits staged during the load.
  • Removed isEvicted, evict(for:), QueryTab.loadEpoch, TableRows.discardRowsKeepingMetadata and evictionTask.
  • Tests changed on purpose:
    • EvictionTests deleted.
    • Eviction cases dropped or rewritten in MainContentCoordinatorLazyLoadTests, MainContentCoordinatorDisplayStateTests, WorkspaceSwitchKeyStateTests, TabSessionRegistryTests, TabSessionRegistryTableRowsTests, TabSessionTests, TableRowsTests and TableRowsRowLocatorTests.
    • MemoryPressureAdvisorTests is now GridDisplayCacheBudgetTests.
  • Docs: docs(tabs): table tabs keep their rows until reloaded docs#129.

Test plan

  • TableTabRowRetentionTests.switchingKeepsEveryTabsRows switches through more table tabs than the cache budget, then checks that every tab keeps its rows and none would reload. It fails on main: rows are dropped and the tab reloads.
  • resigningKeyKeepsRows is a contract test. The old 5 s timer cannot be observed without a fixed sleep, which the test rules forbid.
  • New tests:
    • a reconnect never runs a query tab
    • a parked trigger stays with its tab
    • a changed table waits for an open cell
    • rows are read-only while a load replaces them
  • Unit plan: 26602 executed, 26602 passed, 2 skipped.

Fixes #3841

@datlechin datlechin added the backport release/0.83 Merged into main; pick onto release/0.83 label Oct 26, 2026
@datlechin
datlechin merged commit fcc7073 into main Oct 26, 2026
9 checks passed
@datlechin
datlechin deleted the fix/tab-switch-keeps-results branch October 26, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/0.83 Merged into main; pick onto release/0.83

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tables do not stay in cache for very long anymore

1 participant