Skip to content

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

Open

Description

@FrankChen021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions