Skip to content

fix(schema): refresh the schema tree after DDL (0.19.1) - #62

Merged
killertux merged 2 commits into
mainfrom
fix/schema-tree-refresh
Oct 13, 2026
Merged

killertux merged 2 commits into
mainfrom
fix/schema-tree-refresh

Conversation

@killertux

Copy link
Copy Markdown
Owner

Summary

  • Schema tree refresh (all drivers). The tree cached each level on first expand and never fetched it again. If you expanded a schema while it was empty, then ran CREATE TABLE, the new table never appeared. The empty level also couldn't be expanded again, because descend_or_toggle does nothing when there are no children. A DDL statement only reloaded the autocomplete cache. Reported against Stoolap, but SQLite, Postgres and MySQL behave the same.
    • After DDL, every loaded level still in the tree is introspected again (SchemaPanel::refresh_targets). The cost is bounded by what the user has expanded.
    • populate() now merges into the existing children. Surviving tables keep their node, with their expanded columns/indices subtree, and refreshing a collapsed node doesn't open it.
    • Expanding a level that loaded empty fetches it again, which also picks up tables created by another process.
    • If the selected table is dropped, the selection moves to its parent.
  • Bump to 0.19.1 (patch).

Test plan

  • cargo fmt && cargo clippy --all-targets -- -D warnings && cargo test: 678 tests pass locally. There are 4 new SchemaPanel tests: a table created after an empty load, re-expanding an empty node, subtree and collapse state kept on refresh, and the selection moving to the parent when the selected table is dropped.
  • Manual (tmux, throwaway HOME): expanded an empty stoolap::memory: schema, then ran CREATE TABLE test, CREATE TABLE other and DROP TABLE other. The tree updated after each statement without re-expanding.
  • Manual: same flow on sqlite: and Postgres
  • Manual: ALTER TABLE … ADD COLUMN with the table's columns expanded. The new column should appear.

The tree cached each level on first expand and never re-fetched, so a
table created after its schema was expanded never appeared, and an
empty level dead-ended on expand. After a DDL statement, re-introspect
every loaded node still in the tree; populate() now merges into the
existing children so surviving nodes keep their subtree and expansion,
and a refresh doesn't pop open a collapsed node. Expanding a loaded but
empty node fetches it again. Affects every driver, not just Stoolap.
@killertux
killertux merged commit 148627d into main Oct 13, 2026
3 checks passed
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