Skip to content
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

The structure tool crashed: Error: Interpolations with formatters are not supported when using <Translate>. Found "orphanedMarks, list". #6003

Closed
pacocoursey opened this issue Mar 14, 2024 · 9 comments · Fixed by #6135

Comments

@pacocoursey
Copy link

Describe the bug

When opening a document in our studio, the structure tool crashes with the following error:

Error: Interpolations with formatters are not supported when using <Translate>. Found "orphanedMarks, list". Utilize "useTranslation" instead, or format the values passed to <Translate> ahead of time.
    at parseInterpolation (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-7MHBMVVV.js?v=cbba9afa:79789:11)
    at textTokenWithInterpolation (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-7MHBMVVV.js?v=cbba9afa:79778:18)
    at simpleParser (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-7MHBMVVV.js?v=cbba9afa:79743:27)
    at http://localhost:3333/node_modules/.sanity/vite/deps/chunk-7MHBMVVV.js?v=cbba9afa:79817:53
    at mountMemo (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-QWO7VWAV.js?v=cbba9afa:17050:27)
    at Object.useMemo (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-QWO7VWAV.js?v=cbba9afa:17374:24)
    at useMemo (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-LD72NT7V.js?v=cbba9afa:1094:29)
    at Translate (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-7MHBMVVV.js?v=cbba9afa:79817:46)
    at renderWithHooks (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-QWO7VWAV.js?v=cbba9afa:16404:26)
    at mountIndeterminateComponent (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-QWO7VWAV.js?v=cbba9afa:19154:21)

To Reproduce

Steps to reproduce the behavior:

N/A as our studio is not public, and I don't know what in the document is causing Sanity to crash.

Expected behavior

The structure tool should not crash.

Screenshots
5kZwm4Tf@2x

Which versions of Sanity are you using?

@sanity/cli (global)        3.34.0 (up to date)
@sanity/cli                 3.34.0 (up to date)
@sanity/code-input           4.1.3 (up to date)
@sanity/preview-url-secret   1.6.4 (up to date)
@sanity/ui                  2.0.10 (up to date)
@sanity/vision              3.34.0 (up to date)
sanity                      3.34.0 (up to date)

What operating system are you using?

macOS 14.3.1

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

pnpm 8.8.0
node 20.10.0
@pacocoursey
Copy link
Author

I see this error was introduced #5804, I'm guessing there is a bug in the parsing logic somewhere:

https://github.com/sanity-io/sanity/pull/5804/files#diff-7b6937a9fca6ec03662fd09218c9d2a4c8195ba4e84541b203f2aa2b42709e18R162-R166

@Laruxo
Copy link

Laruxo commented Mar 15, 2024

I have the same issue. It happened after I clicked "safe action" to add some missing marks in a block text. It corrupted my whole document and now I cannot revert the change. In the debugger, I can see this variable interpolation: "{{orphanedMarks, list}}", not sure if it helps.

rexxars added a commit that referenced this issue Mar 16, 2024
Fixes #6003

The `<Translate>` component currently does not support formatters, but I overlooked that the PTE was actually using one of these list formatters in their strings.
@giacomoalonzi
Copy link

giacomoalonzi commented Mar 26, 2024

I had the same problem.

defineField({
      title: 'Title',
      name: 'title',
      type: 'array',
      description: 'Title',
      of: [
        {
          type: 'block',
          styles: [{ title: 'Normal', value: 'normal' }],
          lists: [],
          marks: {
            annotations: [], <---- remove this
            decorators: [], <---- remove this
          },
        },
      ],

removing these 2 lines has fixed my issue. Hope this helps!

@rexxars
Copy link
Member

rexxars commented Mar 27, 2024

This should be fixed in v3.36.1 - thanks for the patience 🙏

@uxderrick
Copy link

@rexxars seen that you fixed yesterday, however I've just also gotten the same error when opening a project in the studio. All other projects open except for that one.

Screenshot:
image

Versions used
"@sanity/client": "^6.15.7",
"@sanity/image-url": "^1.0.2",
"sanity": "^3.36.1",

I'm using a Mac 14.4
node/20.12.0

@malinowskip
Copy link

malinowskip commented Apr 2, 2024

I still encountered this issue in 3.36.2.

It seems like whatever is causing the crash was introduced in 3.30.1. After downgrading to 3.30.0, instead of the page crashing, I’m getting an “Invalid Portable Text value” message in the block editor. In my case, the problem is limited to one document.

Zrzut ekranu 2024-04-2 o 14 07 31

In ^3.30.1, the page is crashing again.

For now, I fixed the affected document by downgrading to 3.30.0, removing invalid values in the block editor, and upgrading to the latest version.

@ericnation
Copy link

I also just encountered this bug in 3.36.2 ...

@dylanfisher
Copy link

dylanfisher commented Apr 9, 2024

Also encountering this bug in 3.31.0, fixed in 3.37.1

@znwhite
Copy link

znwhite commented May 24, 2024

I was able to fix this by removing sanity from my package.json and deleting node_modules etc and then running npm install sanity@latest

But if I didn't remove it from package.json it was stuck on always installing "sanity": "^3.35.2"

Not sure if that even mattered but if it works it works lol. Hope this maybe helps someone else

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 a pull request may close this issue.

9 participants