question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Singleton Document Setup is Complex + [BUG] Its is still repeatable

See original GitHub issue

Describe the bug Creating a singleton document is really hard in Sanity. Just to make it non-ropeable, I had to create extra files & hours of finding proper docs, asking in the slack community etc.

To Reproduce

Steps to reproduce the behavior:

  1. Try to make a singleton document from scratch and see how complex it is.
  2. Click on the Top Edit button (Top-Left: just after name )
  3. Now click the option to add Document
  4. Click on the Singleton Type created
  5. We are still able to create new one

Expected behavior

It should not be able to add an array[] if its singleton, Also the configuration should be as simple using Schema. eg:

"repeatable": false

Screenshots image

So, please consider this issue and try to come up with a better solution.

Thank you. ~Surjith

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:15
  • Comments:9

github_iconTop GitHub Comments

4reactions
pexeixvcommented, Jul 1, 2022

It’s been a year since this issue was created and Sanity still doesn’t want to make the process any simpler? What a shame! Might have to consider another CMS if convenience is not Sanity wants to offer.

2reactions
surjithctlycommented, Jul 2, 2022

@pexeixv I’m with you. But believe me, Sanity is the best CMS apart from these minor issues.

Now I can create singleton in 5 minutes even though its a hack. I’m used to it.

Steps:

  1. Create normal document
  2. Add some content
  3. Disable create & delete as @doublejosh said
  4. That’s it

Here’s how the code looks like: https://github.com/web3templates/stablo/blob/main/studio/schemas/siteConfig.js

Note: Make sure you add step 3 only after 1 & 2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

design patterns - So Singletons are bad, then what?
It's important to distinguish here between single instances and the Singleton design pattern. Single instances are simply a reality.
Read more >
How singleton pattern works with Golang - Medium
In this article, I will present two ways to implement Singleton using Golang, the “Not Thread Safe” form and the “Thread Safe” form....
Read more >
Using module as a singleton in Python - is that ok?
I'd just spell the varibale in all_lower (ALL_UPPER denotes a pseudo-constant) and prefix it with either a single ("protected") or double (" ...
Read more >
Top 10 Most Common Spring Framework Mistakes - Toptal
In case you are not very familiar with Spring Boot but would still like to try out some ... Consider a Spring project...
Read more >
Advanced googletest Topics
This document will show you more assertions as well as how to construct complex ... GTEST_SKIP() can be used in individual test cases...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found