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

Prefer isSingleton, not a singleton function #7941

Merged
merged 2 commits into from Sep 21, 2022

Conversation

Noviny
Copy link
Contributor

@Noviny Noviny commented Sep 20, 2022

This pull request removes the singleton function in favour of users configuring the list instead, with isSingleton.

We are opting to AVOID discretizing list into two discriminated types.
By introducing a singleton function, we may be confusing users into thinking that these are not actually lists.

Instead, users shouldn't have any confusion about whether a list with isSingleton: true is still simply a list.
When configured, the list simply has the following added behaviour traits that revolve around the list containing only 1 item (id: 1):

  • Easy to use in the Admin UI by pathing directly to either create or the item with id: 1
  • Easy to use in the GraphQL API, with query parameters that default to id: 1 for reduce verbosity when using singletons

@vercel
Copy link

vercel bot commented Sep 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview Sep 20, 2022 at 4:44AM (UTC)

@changeset-bot

This comment was marked as resolved.

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 93c16e5:

Sandbox Source
@keystone-6/sandbox Configuration

@vercel vercel bot temporarily deployed to Preview September 20, 2022 04:44 Inactive
@dcousens dcousens changed the title use isSingleton not singleton function Prefer isSingleton, not a singleton function Sep 21, 2022
@dcousens
Copy link
Member

dcousens commented Sep 21, 2022

I don't know if this will be how we continue to do this by the next major, but I think this is the best compromise for now

@dcousens dcousens merged commit b8d88f2 into main Sep 21, 2022
@dcousens dcousens deleted the noviny/remove-singleton-function branch September 21, 2022 03:47
@dcousens dcousens mentioned this pull request Sep 21, 2022
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 this pull request may close these issues.

None yet

2 participants