sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.33k stars 431 forks source link

Vision tool is crashing, seemingly by fault of the codemirror package #5509

Open piofinn opened 10 months ago

piofinn commented 10 months ago

Describe the bug

The vision tool crashes when opened, after a brief flash of the page layout. The error message (see screenshot below) points to multiple installed versions of @codemirror/state as a possible culprit.

To Reproduce

  1. Configure Sanity Studio with the visionTool plugin
  2. Open Sanity Studio and click on the "Vision" tab
  3. Observe the bug

Expected behavior

The vision tool should work as expected

Screenshots

Skjermbilde 2024-01-16 kl  15 56 39 (The two cut-off lines read "breaking instanceof checks")

Which versions of Sanity are you using?

@sanity/cli (global)          3.24.1 (up to date)
@sanity/eslint-config-studio   3.0.1 (up to date)
@sanity/icons                  2.8.0 (up to date)
@sanity/ui                     2.0.0 (up to date)
@sanity/vision                3.24.1 (up to date)
sanity                        3.24.1 (up to date)

What operating system are you using?

MacOS 13.6.1

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

node: 20.9.0 pnpm: 8.3.1 (npm: 10.1.0)

Additional context

Other installed tool plugins are sanity-plugin-media and sanity/structure, with both working as expected.

package.json:

{
  "name": "****",
  "private": true,
  "version": "1.0.0",
  "main": "package.json",
  "scripts": {
    "dev": "sanity dev",
    "start": "sanity start --host=0.0.0.0",
    "build": "sanity build",
    "deploy": "sanity deploy",
    "deploy-graphql": "sanity graphql deploy",
    "typecheck": "tsc"
  },
  "keywords": [
    "sanity"
  ],
  "dependencies": {
    "@sanity/icons": "^2.8.0",
    "@sanity/ui": "^2.0.0",
    "@sanity/vision": "^3.24.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-is": "^18.2.0",
    "sanity": "^3.24.1",
    "sanity-plugin-media": "^2.2.5",
    "styled-components": "^5.3.9"
  },
  "devDependencies": {
    "@sanity/eslint-config-studio": "^3.0.1",
    "@types/react": "^18.0.25",
    "@types/styled-components": "^5.1.26",
    "eslint": "^8.6.0",
    "prettier": "^3.2.2",
    "typescript": "^5.1.6"
  }
}
deckchairlabs commented 10 months ago

Yeah, this is also happening for me.

pedrobonamin commented 10 months ago

Hey @piofinn and @deckchairlabs could you please try removing your node_modules and pnpm.lock file and running a new install?

rm -rf node_modules pnpm-lock.yaml
pnpm i

You can find more info in this issue in codemirror

Please, let us know if that fixed the issue.

deckchairlabs commented 10 months ago

Hey @pedrobonamin, sorry for delay in getting back to, your solution above fixed the issue for me! Thanks