Skip to content

Cannot resolve a DOM node from Slate node uncaught error since Sanity v4.1.0 #298

@indeox

Description

@indeox

Describe the bug

When a PortableText area has a code type block, and the window is unmounted for whatever reason (switching to another post, or closing the editor pane), Slate throws up an error.

  • Changes seem to be saved successfully 👍
  • But the error is quite "loud" 😔

To Reproduce

  1. Go to a post with a code block on it
  2. Make sure the PortableTextEditor is active by clicking on it
  3. Switch to a different post OR close the editor pane
  4. See error

Expected behavior

No error should be shown

Screenshots

codeinput-bug.mp4

Which versions of Sanity are you using?

@sanity/cli (global)          4.6.1 (up to date)
@sanity/code-input            6.0.1 (up to date)
@sanity/eslint-config-studio  5.0.2 (up to date)
sanity                        4.6.1 (up to date)

What operating system are you using?

macOS 15.6.1

Which versions of Node.js / npm are you running?

Run npm -v && node -v in the terminal and copy-paste the result here.

10.9.2
v22.17.1

Additional context

I tested reverting Sanity back a few versions, and the issue looks like it started since v4.1.0

It seems to be happy on v4.0.1

GitHub reduced reproduction project

I've made a reduced bug repro here if it helps
https://github.com/indeox/sanity-codeinput-bug-repro

Hope this helps track it down. Happy to help in any way possible 🤗

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions