Object tree: add a control to read the objects again

Aperta
#1,986 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@StavanRKhobare ci sta già lavorando.

Dal 27/10/2026.

  • #2123 di @StavanRKhobare — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement good first issue help wanted

Summary

The object tree has no control a user can press to read it again.
It re-reads only when a statement run inside Studio changes the catalog, so a table created by another client, a migration, or a teammate does not show up until the page is reloaded.

The Source tab already has this control since #1407 ("Read this definition again" in its header, data-testid="object-source-refresh").
The tree is the missing half.

What exists already

  • useTreeNodes returns refresh() (src/components/object-tree/use-tree-nodes.ts), which re-issues the container read and every expanded folder's read without collapsing the tree.
  • ObjectTree takes a refreshToken prop and calls refresh() when it changes (src/components/object-tree/ObjectTree.tsx, the effect on refreshToken).
  • Both shells own a counter for it: objectRefreshToken and objectsChanged in src/components/Studio.tsx, and objectRefreshToken in src/workspace/StudioWorkspace.tsx.

So no new read path is needed: the button calls the existing refresh.

What to do

  1. Add an icon button with aria-label="Read the objects again" above the tree in src/components/sidebar/Sidebar.tsx, next to the Objects / Keys switch, shown only while the object tree is shown.
    Use RefreshCw from lucide-react, as the Source tab and the Keys panel do.
  2. Pressing it calls the tree's refresh() directly, or bumps a counter the tree already listens to. Do not add a second counter beside objectRefreshToken; if the shell's counter is used, note that it also marks open Source tabs stale, and decide in the PR whether that is wanted.
  3. Disable it while a deferred tree (deferred, the "Do not read the object list on connect" setting) has not been loaded yet, so it never starts a read the user opted out of.
  4. The embedded package shell (StudioWorkspace) renders the same Sidebar, so check the button there too.

Tests

  • tests/components/object-tree.test.tsx or a sidebar test: pressing the button issues a fresh containers read, keeps an expanded container expanded, and shows an object the second answer adds.
  • A deferred tree: the button is disabled and pressing it reads nothing.

Acceptance criteria

  • A table created from another client appears in the tree after pressing the button, without a page reload.
  • Expanded containers stay expanded across the refresh.
  • The button has an accessible name and works from the keyboard.
  • bun run test:coverage && bun run coverage:check stays at 100% line coverage.
Lingua principale
TypeScript
Stelle
810
Fork
158
Merge medio
10h 9m
PR unite (30g)
603

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libredb/libredb-studio

Tutte le issue di libredb/libredb-studio

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.