Duplicating content in Sanity Studio v3.40.0 causes reference issues

8 replies
Last updated: May 21, 2024
🧵 Curious if this is a known bug - using studio v
3.40.0
PEBKAC
AI Update

"PEBKAC" stands for "Problem Exists Between Keyboard And Chair" - it's a humorous way of saying the issue was user error, not a bug! 😄

So it sounds like you figured out the issue you were experiencing in Studio v3.40.0 was on your end rather than a bug in Sanity itself. Glad you got it sorted out!

If you do run into any actual bugs or unexpected behavior in the future, the Sanity GitHub repository is a great place to check existing issues or report new ones. The Sanity team is pretty responsive there.

And hey, we've all had PEBKAC moments - they're often the best learning experiences! If you want to share what the issue was, it might help someone else who runs into the same thing.

Duplicating content in an array using the default "Duplicate" option does some interesting things.
If you duplicate an object, then edit a field in one instance - all other fields get updated.
Kinda looks like the duplicated content receives the same id.
Heres a barebones query showing the id issue, which is what I think this stems from.
From your query it looks like cards are references, so you’re duplicating the card but it’s pointing at the same document.
Ahh gotcha
That makes total sense - I was hitting a wall here. 🤦Thanks
😆
I think what you’ll need to do is:
1. Open the referenced document.
2. Duplicate it from the menu in the bottom-left.
3. [Make changes now or later]
4. Go back to the source document.
5. Change the reference to point at the new document.
All good!

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?