Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Issue with portable text causing crashes in Sanity Studio 3.29.0

11 replies
Last updated: Feb 15, 2024
Hi, I have a problem with portable text in Sanity Studio 3.29.0. In Sanity Studio 3.24.1 I don’t encounter this issue.
Whenever I add a block array (copied and pasted from docs) my structure tool crashes. In fact, the document either does not load or returns this error:


Error: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-G7CAILKR.js?v=ca194635:107199:19>)
…
My schema looks like this:

export default {
  name: 'pageNotFound',
  title: '404',
  type: 'document',
  fields: [
    {
      title: 'Bild',
      name: 'image',
      type: 'image',
    },
    {
      title: 'Überschrift',
      name: 'headline',
      type: 'string',
    },
    {
      title: 'Absatz',
      name: 'paragraph',
      type: 'string',
    },
    {
      name: 'content',
      type: 'array',
      title: 'Content',
      of: [
        {
          type: 'block'
        }
      ]
    }
  ],
}
As soon as I remove the block array the document loads again and the error disappears. Does anybody know how to fix this?
Feb 14, 2024, 4:17 PM
Hey I have the same issue for some reason – did you find a solution?
Feb 14, 2024, 5:10 PM
Can you share an example of the content you’re pasting in?
Feb 14, 2024, 5:15 PM
I've got this same issue too, just upgraded everything Sanity related to latest.
Feb 14, 2024, 5:17 PM
Block content defined like so in my schema...

...
defineField({
      name: 'byline',
      type: 'array',
      of: [
        {
          type: 'block',
          styles: [{title: 'Normal', value: 'normal'}],
          lists: [],
          marks: {
            decorators: [
              {title: 'Strong', value: 'strong'},
              {title: 'Emphasis', value: 'em'},
            ],
          },
        },
      ],
      title: 'Byline',
      description: 'Page introduction, appears below the title',
      group: 'settings',
    }),
...
Sanity packages...

"dependencies": {
    "@sanity/dashboard": "^3.1.6",
    "@sanity/ui": "^2.0.2",
    "@sanity/vision": "^3.29.0",
    "ndjson": "^2.0.0",
    "next-sanity": "^8.0.0",
    "ordinal": "^1.0.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-icons": "^5.0.1",
    "react-is": "^18.2.0",
    "recharts": "^2.12.0",
    "sanitize-html": "^2.11.0",
    "sanity": "^3.29.0",
    "sanity-plugin-dashboard-widget-document-list": "^1.0.1",
    "sanity-plugin-documents-pane": "^2.2.1",
    "sanity-plugin-media": "^2.2.5",
    "sanity-plugin-mux-input": "^2.2.4",
    "sanity-plugin-tags": "^2.0.1",
    "sanity-plugin-utils": "^1.6.4",
    "styled-components": "^6.1.8"
  },
  "devDependencies": {
    "@sanity/eslint-config-studio": "^3.0.1",
    "@types/react": "18.2.0",
    "@types/styled-components": "^5.1.34",
    "eslint": "^8.56.0",
    "prettier": "^3.2.5",
    "typescript": "^5.3.3"
  },
Error message...

Error: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41700:19>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
    at getRandomValues (<http://localhost:3333/node_modules/.sanity/vite/deps/chunk-F33BQELL.js?v=64d014bb:41704:10>)
Feb 14, 2024, 5:22 PM
I used:
export default {
	title: "Content",
	name: "normal",
	type: "array",
	of: [
		{
			type: "block",
			styles: [{ title: "Normal", value: "normal" }],
		},
	],
};
Feb 14, 2024, 5:27 PM
Made an ultra minimal repo for the issue:
https://github.com/j2is/sanity-portable-text-bug
Feb 14, 2024, 5:28 PM
Added it here if it helps, thanks so much
https://github.com/sanity-io/sanity/issues/5741
Feb 14, 2024, 5:47 PM
Experiencing the same issue over here with sanity
3.29.0
Feb 14, 2024, 6:34 PM
We’ve identified the issue and are working on a fix
Feb 14, 2024, 6:34 PM
The fix should be live!
Feb 14, 2024, 8:24 PM
Thanks for the fast fix! Just updated and its working again!
Feb 15, 2024, 7:36 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?