python-editor-v3 icon indicating copy to clipboard operation
python-editor-v3 copied to clipboard

[CodeMirror] Crash in drawSelection extension

Open microbit-matt-hillsdon opened this issue 3 years ago • 0 comments
trafficstars

This one happened immediately on navigating to, but not opening, the Dice Idea.

I guess it's possible it is the read-only CM in the sidebar.

TypeError: Cannot read properties of null (reading 'top')
  at addSpan(../node_modules/@codemirror/view/dist/index.js:7415:39)
  at drawForLine(../node_modules/@codemirror/view/dist/index.js:7441:13)
  at measureRange(../node_modules/@codemirror/view/dist/index.js:7387:33)
  at ? (../node_modules/@codemirror/view/dist/index.js:7299:74)
  at Array.map(<anonymous>)
  at read(../node_modules/@codemirror/view/dist/index.js:7299:50)
  at ? (../node_modules/@codemirror/view/dist/index.js:6380:34)
  at Array.map(<anonymous>)
  at measure(../node_modules/@codemirror/view/dist/index.js:6378:42)
  at wrappedArguments(../node_modules/@codemirror/view/dist/index.js:6505:79)
  at i(../../../../browser/src/helpers.ts:73:23)

On the face of it none of our code is involved in this one.

The line in question seems to be something of a hack, it uses any in the TypeScript source to allow it to pass 2 or -2 as the side parameter. This seems to be a kind of internal API, 2/-2 are special cased even though they're not valid according to the parameter types.

Let's see if we can come up with a repro.

Chrome 107/Windows.

microbit-matt-hillsdon avatar Nov 04 '22 12:11 microbit-matt-hillsdon