Skip to content

Conversation

@bluesnotred
Copy link

Selecting an image and pressing Backspace/Delete throws:

TypeError: Cannot assign to read only property '_cachedNodes' of object '#<_NodeSelection>'

The cached this.#selection.current may be frozen after certain Lexical operations. Using fresh $getSelection() instead fixes this.

Related: facebook/lexical#6290

The cached selection may be frozen, causing '_cachedNodes' read-only error.
Use fresh $getSelection() instead of this.#selection.current.

Related: facebook/lexical#6290
Same frozen selection issue in #withCurrentNode() - use fresh $getSelection().
@bluesnotred
Copy link
Author

Added a second fix in 6fd45b8 - the #withCurrentNode() method in selection.js had the same frozen selection problem, causing errors when using arrow keys to navigate between attachments.

@OtherCroissant
Copy link
Contributor

#494

@ksweetie
Copy link

I'm experiencing the same issue and can confirm that this PR fixes it for me. Thanks for fixing!

@jorgemanrubia
Copy link
Member

Hey @bluesnotred thanks for looking into this one. I think the problem here was related to having some sort of stale assets. I could reproduce with the version from main when building the assets with yarn watch, but then I ran yarn build and the error went away. I need to look into the reasons. Could you confirm if the last version fixes the problem for you? https://github.com/basecamp/lexxy/releases/tag/v0.1.25.beta

jorgemanrubia added a commit that referenced this pull request Jan 5, 2026
In development mode, Lexical freezes the selection objects, including _cachedNodes. When your code tried to modify _cachedNodes, it threw:

  TypeError: Cannot assign to read only property '_cachedNodes' of object '#<_NodeSelection>'

Related #507 (comment)

Also, always generate source maps
@jorgemanrubia
Copy link
Member

Will prevent this here #540

@jorgemanrubia
Copy link
Member

Tentatively closing @bluesnotred @ksweetie @OtherCroissant. Please let me know if you are still experiencing the issue with latest version.

@OtherCroissant
Copy link
Contributor

OtherCroissant commented Jan 5, 2026

@jorgemanrubia I still have the same error deleting the attachments. Although I have the new table feature now, so the new version seems to be loaded?
Scherm­afbeelding 2026-01-05 om 14 40 00

Scherm­afbeelding 2026-01-05 om 14 40 47

I also don't see the html content of the lexxy editor in my console anymore so the development mode seems to be disabled correctly

@jorgemanrubia
Copy link
Member

Thanks @OtherCroissant. How are you installing Fizzy in your app? Using the gem or via the NPM package? I would like to reproduce this. I have tried to update the gem in Fizzy and not having issues there with deleting attachments.

@jorgemanrubia
Copy link
Member

Oh I see it is included via the NPM package. Maybe that is the key. I will look into it.

@jorgemanrubia
Copy link
Member

@OtherCroissant I just released a new version that should take care of this one

https://github.com/basecamp/lexxy/releases/tag/v0.1.27.beta

I would appreciate it if you can confirm. Thanks!

@seanhogge
Copy link

Hi everyone. I was having this same issue in a project that has a LOT of JavaScript going on, so I don't know if my experience is pure enough to be useful.

However, 0.1.27-beta fixes this issue and I can now delete inserted attachments (images and mentions).

The work here is appreciated, we're hoping to use Lexxy as soon as it's viable.

@jorgemanrubia
Copy link
Member

Great thanks for confirming @seanhogge

@OtherCroissant
Copy link
Contributor

Works now for me as well!! Thanks!

@bluesnotred
Copy link
Author

Hey Jorge, thanks for looking into this. I've confirmed the fix works:

  • Reproduced the _cachedNodes error on v0.1.23.beta again
  • Verified v0.1.27.beta resolves the issue

Appreciate the thorough fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants