Skip to content

Cannot read properties of null (reading 'parent') during flushLocalChanges #386

@rcbevans

Description

@rcbevans

I'm using

    "@slate-yjs/core": "^0.3.1",
    "@slate-yjs/react": "^0.3.0",
    "slate": "^0.91.3",
    "slate-history": "^0.86.0",
    "slate-hyperscript": "^0.77.0",
    "slate-react": "^0.91.3",
    "y-protocols": "^1.0.5",
    "y-websocket": "^1.4.5",
    "yjs": "^13.5.47",

I am seeing infrequent errors (Cannot read properties of null (reading 'parent')) coming from yjs YText (yjs/src/types/YText.js) that I have been unable to reproduce, but are cropping up occasionally in production telemetry when users are collaborating on a document.

Call stack is

Crashed in non-app:
../../../node_modules/yjs/src/types/YText.js
in deleteText
<anonymous> in Array.forEach
Called from:
../../../node_modules/@slate-yjs/core/src/plugins/withYjs.ts
in f
<anonymous> in Array.forEach
Called from:
../../../node_modules/@slate-yjs/core/src/plugins/withYjs.ts
in e.flushLocalChanges

The crashing line is

  const parent = /** @type {AbstractType<any>} */ (/** @type {Item} */ (currPos.left || currPos.right).parent)

I'm not sure this is a slate-yjs specific (or even necessarily related) issue given the erroring code is in yjs:::YText, I will post an issue there too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions