Web console: line numbers on sub-query run markers repeat after each edit

Aperta Adatta ai principianti
#20,605 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
80/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Il bug si trova in SubQueryMarker.toDOM() in web-console/src/views/workbench-view/flexible-query-input/sub-query-markers.ts, che restituisce un DocumentFragment con due nodi dove CodeMirror ne si aspetta uno. Inizia da lì, riproduci il problema digitando nell'editor SQL del workbench vicino a query con marker di esecuzione e conferma che il numero di riga si ripete. È completato quando il numero su una riga con marker resta singolo dopo modifiche ripetute e il pulsante di esecuzione continua a funzionare.

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

Descrizione

Area - Web Console Bug
Affected Version

master, since #20507.

Description

In the workbench SQL editor, the line number of a line that has (or had) a sub-query "run" marker repeats its digits after each edit. For example, line 6 shows 6666666 and line 14 shows 1414.

Image

To reproduce: in the workbench, write a few queries separated by blank lines so they get "run" markers, then keep typing. The numbers on the marker lines grow by one copy per edit. Lines that never had a marker are not affected.

Cause

SubQueryMarker.toDOM() in web-console/src/views/workbench-view/flexible-query-input/sub-query-markers.ts returns a DocumentFragment with two nodes, the run button and the line number text:

const fragment = document.createDocumentFragment();
fragment.append(button, String(this.lineNumber));
return fragment;

CodeMirror assumes one DOM node per gutter marker: when it replaces a marker, GutterElement.setMarkers removes only the first node (domPos.remove()). The run button is removed, but the old number text node stays. The subQueries state field rebuilds the markers on every document change, so a marker line gains one more copy of its number with each edit.

Suggested fix

Return a single element, so CodeMirror removes the number with the button:

const element = document.createElement('span');
element.append(button, String(this.lineNumber));
return element;

@vogievetsky, this came in with #20507. Could you take a look?

Lingua principale
Java
Stelle
14.1k
Fork
3.8k
Merge medio
2g 6h
PR unite (30g)
234

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 apache/druid

Tutte le issue di apache/druid

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.