Skip to content

fix(structure): refresh picks up external schema changes (#1281)#1288

Merged
datlechin merged 1 commit into
mainfrom
fix/structure-refresh-1281
May 16, 2026
Merged

fix(structure): refresh picks up external schema changes (#1281)#1288
datlechin merged 1 commit into
mainfrom
fix/structure-refresh-1281

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Closes #1281.

The user-visible bug had two layers behind one symptom (Structure tab not refreshing after an external DDL change):

  • Cell rendering cache. DataGridCoordinator.displayCache keys cached cell text by row.id, but TableRows.from(queryRows:...) assigns positional ids (.existing(index)). When external DDL changes a cell's underlying value without changing row count, the cache hits and tableView.reloadData() returns the stale text. The Structure → Columns sub-tab was the most visible victim. Fix: thread ChangeManaging.reloadVersion into DataGridUpdateSnapshot. When that version differs, applyStructuralUpdate invalidates the display cache and forces a full reload. No call-site change — every existing consumer already passes an AnyChangeManager that bumps reloadVersion on every mutation.
  • Loaded-tab cache. reloadAllTabs() never cleared loadedTabs, so DDL/FK sub-tabs the user had previously visited rendered stale state on next switch. Also ClickHousePartsView never subscribed to AppCommands.shared.refreshData, so ⌘R didn't reach it. Fix: clear loadedTabs at the top of reloadAllTabs(), and wire Parts to the refresh signal.

Test plan

  • ClickHouse: external ALTER TABLE x RENAME COLUMN a TO b → ⌘R on Structure → Columns sub-tab shows b immediately, no tab switch needed.
  • Same scenario → switch to DDL sub-tab → generated CREATE TABLE shows b.
  • Parts sub-tab: external INSERT creates a new part → ⌘R → Parts list updates.
  • Cell edit (Data tab): edit a cell, Tab away → cell shows edited value.
  • Cell edit (Create Table dialog): rename a column in the builder → grid reflects the rename.
  • State preservation: type in Filter, sort a column, ⌘R → both persist.
  • Large Data tab query: run a query that returns thousands of rows, ⌘R → no visible flicker or slowdown beyond previous behavior.

@datlechin datlechin merged commit 977df11 into main May 16, 2026
2 checks passed
@datlechin datlechin deleted the fix/structure-refresh-1281 branch May 16, 2026 11:06
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.

Structure Tab Does Not Refresh After DDL Changes in ClickHouse

1 participant