questdb/ui

Application crashes with empty Grid in development mode

Closed this issue · 1 comments

insmac commented

Steps to reproduce: (note: this happens in development mode only)

  1. Make sure there are no records and no columns in the grid (i.e. refresh the Console).
  2. Go to any page other than the sql editor: Import or Settings.
  3. Go back to the editor. The application will crash with the following JavaScript error in Developer Console:
CleanShot 2023-08-07 at 12 56 22@2x

The issue seems to be caused by this code in grid.js

function setFocusedColumn(columnIndex) {
    if (columnIndex !== -1) {
      focusedColumnIndex = columnIndex
      const cell = focusedColumnIndex < freezeLeft ? focusedRowContainerLeft.childNodes[focusedColumnIndex] : focusedRowContainer.childNodes[focusedColumnIndex % visColumnCount]
      cell.columnIndex = focusedColumnIndex
      setFocusedCell(cell)
    }
  }

cell conditional (focusedColumnIndex < freezeLeft) evaluates to false and breaks down on focusedColumnIndex % visColumnCount which equals to NaN.

closed by #198