Skip to content

[CodeMirror] Crash in drawSelection extension #1065

Open

Description

@microbit-matt-hillsdon

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions