Skip to content

@sanity/vision and @sanity/code-input are both using a different version of @codemirror/state #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ootes opened this issue Jan 30, 2024 · 7 comments

Comments

@ootes
Copy link

ootes commented Jan 30, 2024

Describe the bug

@sanity/vision and @sanity/code-input are both using a different version of @codemirror/state. This is causing Sanity vision / Santiy code input plugin to throw to following error:
Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.

To Reproduce

  • Install latest version of Sanity 3.26.1
  • Install the latest version of Sanity Vision 3.26.1
  • Install the latest version of code-input 4.1.2
  • Load a page with either the vision editor or the code-input field on it

Screenshots
image

image

Which versions of Sanity are you using?
@sanity/code-input 4.1.2 (up to date)
@sanity/vision 3.26.1 (up to date)
sanity 3.26.1 (up to date)

@tomaszter
Copy link

Same problem! For me, it has nothing to do with Vision. The error still appears even when I deactivate Vision.
sanity 3.30.0
@sanity/code-input 4.1.3

@mvellandi
Copy link

Same thing here:
sanity 3.30.1
@sanity/[email protected]
@sanity/code-input 4.1.3

@dangreaves
Copy link

I don't think this has anything to do with vision.

The dependency tree for @sanity/code-input is installing two separate versions of @codemirror/state (6.4.0 and 6.4.1).

pnpm ls @codemirror/state --depth 10

dependencies:
@sanity/code-input 4.1.2
├─┬ @codemirror/autocomplete 6.12.0
│ ├─┬ @codemirror/language 6.10.1 peer
│ │ ├── @codemirror/state 6.4.0
│ │ └─┬ @codemirror/view 6.23.1
│ │   └── @codemirror/state 6.4.0
│ ├── @codemirror/state 6.4.1 peer
│ └─┬ @codemirror/view 6.24.1 peer
│   └── @codemirror/state 6.4.1
├─┬ @codemirror/commands 6.3.3
│ ├─┬ @codemirror/language 6.10.1
│ │ ├── @codemirror/state 6.4.0
│ │ └─┬ @codemirror/view 6.23.1
│ │   └── @codemirror/state 6.4.0
│ ├── @codemirror/state 6.4.0
│ └─┬ @codemirror/view 6.23.1
│   └── @codemirror/state 6.4.0
└─┬ @codemirror/lang-html 6.4.7
  └─┬ @codemirror/autocomplete 6.12.0
    └─┬ @codemirror/language 6.10.1 peer
      ├── @codemirror/state 6.4.0
      └─┬ @codemirror/view 6.23.1
        └── @codemirror/state 6.4.0

When I pin @codemirror/state to 6.4.1 using pnpm.overrides, the problem goes away.

@rexxars
Copy link
Member

rexxars commented Dec 14, 2024

Could you see if upgrading to @sanity/code-input@^5.1.0 solves the issue?

@andrilla-francis
Copy link

I have the same issue, but I'm not using @sanity/code-input in my project at all. I haven't had this issue until recently updating my dependencies with bun update --latest.

"dependencies": {
  "@sanity/vision": "^3.67.1",
  "react": "^18.3.1",
  "react-dom": "^18.3.1",
  "sanity": "^3.67.1",
  "sanity-plugin-media": "^2.3.2",
  "styled-components": "^6.1.13"
},
"devDependencies": {
  "@sanity/eslint-config-studio": "^5.0.0",
  "@types/react": "^18.3.12",
  "eslint": "^9.17.0",
  "prettier": "^3.4.2",
  "typescript": "^5.7.2"
}

@jamestrenda
Copy link

Getting this error as well with 5.1.2. I'm on 3.70.0 of the studio, groq, and vision. It breaks my whole PortableText editor. The error occurs when selecting a different language other than Plain Text. I've tested this multiple times with the same results.

@jamestrenda
Copy link

jamestrenda commented Feb 27, 2025

Getting this error as well with 5.1.2. I'm on 3.70.0 of the studio, groq, and vision. It breaks my whole PortableText editor. The error occurs when selecting a different language other than Plain Text. I've tested this multiple times with the same results.

Deleted pnpm-lock.yaml as well as node_modules, upgraded to latest sanity version and everything seems to be working now.

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

No branches or pull requests

7 participants