Glitches with internal links in Studio, resolved by cutting and pasting raw content

6 replies
Last updated: Jul 3, 2022
Hello, I am running into a weird issue – I followed
user Y
’s tutorial on how to create internal and external link. Everything worked fine until I added multiple types of internal links (references). Since than, the Studio started glitching.
What is happening:
1. I click the internal link button (reference to
tool
) and the
span
is created but there’s no link and no lookup appear.2. I can delete the “link” but can’t edit it. When I click the edit button (pen icon), nothing happens.
Here is a video:
https://vimeo.com/725020264/3bd96ea083
The other buttons related to other content types (
topic
,
term
) work most of the time but it is not 100%. The problem is that I don’t have a clue where to start looking. No console errors, no regular behaviour. The code has the same logic:
annotations: [
                        {
                            name: "toolLink",
                            type: "object",
                            title: "Tool Link",
                            blockEditor: {
                                icon:  () => <div>A</div>,
                            },
                            fields: [
                                {
                                    name: 'tool',
                                    type: "reference",
                                    to: [
                                        {type: 'tool'},
                                    ]
                            }
                            ]
                        },
                        {
                            name: "topicLink",
                            type: "object",
                            title: "Topic Link",
                            blockEditor: {
                                icon:  () => <div>L</div>,
                            },
                            fields: [
                                {name: 'topic',
                                type: "reference",
                                title: "Reference",
                                to: [
                                    {type: 'topic'},
                                ]
                            }
                            ]
                        },
                        {
                            name: "termLink",
                            type: "object",
                            title: "Term Link",
                            blockEditor: {
                                icon:  () => <div>B</div>,
                            },
                            fields: [
                                {name: 'term',
                                type: "reference",
                                to: [
                                    {type: 'term'},
                                ]
                            }
                            ]
                        },
                            {
                            name: "link",
                            type: "object",
                            title: "URL",
                            blockEditor: {
                                icon:  () => <div>🌍</div>,
                            },
                            fields: [
                              {
                                title: "URL",
                                name: "href",
                                type: "url",
                              },
                              {
                                title: "Open in a new window",
                                name: "blank",
                                type: "boolean",
                              },
                            ],
                          },
                    ],
Any Idea about where to look? Thanks for the help!
Jun 28, 2022, 8:04 PM
Also tried to disable all chrome extension. Tried a different browser (Edge) – still the same.
Jun 28, 2022, 9:11 PM
Hey
user M
! Unfortunately, I'm unable to replicate this. What version of the Studio are you running? Are there any errors in the console when you click on the edit button?
Jun 29, 2022, 4:55 PM
Hello, I run the latest version (will find exactly). and I see no errors 😕
Jun 29, 2022, 4:56 PM
ooookay, I got it 😄 What happened (maybe it will help others)?1. I started with one type of internal link call
internalLink
.2. I change the name of it to
toolLink
and added two other types –
termLink
and
topicLink
. Then the glitches started (no errors anywhere).3. Today, when I was looking into JSON in Inspect view, I spotted the original
internalLink
in related
markDefs
.4. I cut the raw text from Block content, saved the post, pasted the raw content back and successfully added the link. Now the
_types
are correct.So it seems like the text preserved the original span with
internalLink
type. When I tried to add another link to the same text, it couldn’t work because the original
_type
internalLink
did not exist anymore.
user M
is there something on the technical side I should do in differently? My project is still very early in the development but I also work simultaneously on the content. Not the optimal way, I know 😉
Thank you.
Jun 29, 2022, 8:39 PM
Thanks for outlining your steps for a fix here. It sounds like the
internalLink
mark existed in the data but no longer in your schema, so the PTE's brain got a bit fried trying to display it. I would have thought that the Studio would have thrown an error when it came across a block that wasn't defined in the schema, though 🤔 .
Jul 1, 2022, 5:04 PM
Yes, this would be nice. Thanks!
Jul 3, 2022, 8:20 AM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?

Categorized in