Altinity / Altinity/altinity-sql-browser

A whitespace-only tile description beats the query description (the #476 sibling)

Aperta Adatta ai principianti
#489 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

inbox
Lingua principale
TypeScript
Stelle
8
Fork
2
Merge medio
1h 34m
PR unite (30g)
6

Descrizione

Spotted while shipping #429 phase 1 (#476's title trim). Deferred deliberately:
#476's scope, and its acceptance criterion, are about the title — a blank
description corrupts no accessible name, so it did not belong in that PR.

The gap

src/dashboard/application/dashboard-viewer-session.ts:562-563 — one line below
the title that #429 phase 1 just fixed:

const description = (typeof tile.description === 'string' && tile.description)
  || (typeof query?.spec?.description === 'string' ? query.spec.description : '');

A whitespace-only tile.description is truthy, so it beats the query's own
description exactly the way a whitespace-only tile.title used to beat the query
name. dashboardTileV1.description carries no minLength, so such a document is
schema-legal.

What the user sees

src/ui/dashboard.ts:1881-1883 renders the description conditionally:

ts.description ? h('span', { class: 'dash-tile-desc', title: ts.description }, ts.description) : null

so " " renders an empty .dash-tile-desc span with a whitespace title
tooltip
, taking vertical space under the heading, instead of falling back to the
query description that is sitting right there.

The inconsistency it leaves

src/application/dashboard-tree-model.ts:279 already trims tile description for
its search haystack. After #429 phase 1 the tree and the viewer agree on title and
disagree on description — the tree treats blank as absent, the canvas does not.

Suggested fix

The same one-line shape phase 1 applied to the title:

const authoredDescription = typeof tile.description === 'string' ? tile.description.trim() : '';
const description = authoredDescription
  || (typeof query?.spec?.description === 'string' ? query.spec.description : '');

Needs its own test, for the same reason the title trim did: it is a behaviour
change for existing documents carrying such a description. No shipped UI writes
tile.description today, so only hand-authored and imported documents are
affected.

Related, same class, but NOT for this issue

src/ui/file-menu.ts reads dashboard.title untrimmed (:630, :648, :1010,
:1044 — the last one produces a whitespace export filename), while
src/application/dashboard-tree-model.ts:382 trims it. That one belongs to
#429 phase 3, which owns the Dashboard rename pencil and is already required
to "apply the same rule to any title this issue's dialogs write" — it is recorded
in the #429 ship log rather than filed here.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia da src/dashboard/application/dashboard-viewer-session.ts:562-563 e confronta la gestione esistente del titolo con src/application/dashboard-tree-model.ts:279. Esamina il rendering in src/ui/dashboard.ts:1881-1883, quindi aggiungi un test di regressione per una descrizione del riquadro composta solo da spazi; il lavoro è completo quando viene usata come fallback la descrizione della query senza eseguire il rendering di un elemento descrizione vuoto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
78/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.