-
Notifications
You must be signed in to change notification settings - Fork 58
Description
After inserting a custom decorator into the document and then typing more, I get the following crash:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[Lexical.LayoutManager _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] *** attempted layout while textStorage is editing. It is not valid to cause the layoutManager to do layout while the textStorage is editing (ie the textStorage has been sent a beginEditing message without a matching endEditing.)'
The crash is on line 544 of Editor:
frontend?.layoutManager.invalidateLayout(forCharacterRange: rangeCacheItem.range, actualCharacterRange: nil)
This makes me very nervous to use the library in production, any advice on how to avoid this crash?
Here's the JSON of my lexical right before the crash (I was printing after every edit):
{
"root": {
"direction": null,
"format": "",
"indent": 0,
"type": "root",
"children": [
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "Test niceee ",
"version": 1,
"type": "text"
},
{
"type": "timestamp",
"version": 1,
"timestamp": 34.43114
},
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": " ",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "New line fdsa ",
"version": 1,
"type": "text"
},
{
"type": "timestamp",
"version": 1,
"timestamp": 34.43114
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "E",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "Weeeeee",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "Weeee",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "Da",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "Test ",
"version": 1,
"type": "text"
},
{
"type": "timestamp",
"version": 1,
"timestamp": 34.43114
},
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": " ",
"version": 1,
"type": "text"
},
{
"format": 1,
"detail": 0,
"style": "",
"mode": "normal",
"text": "tello",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "F",
"version": 1,
"type": "text"
}
],
"version": 1
},
{
"direction": null,
"format": "",
"indent": 0,
"type": "paragraph",
"children": [
{
"format": 0,
"detail": 0,
"style": "",
"mode": "normal",
"text": "F",
"version": 1,
"type": "text"
}
],
"version": 1
}
],
"version": 1
}
}