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

Singletons #7575

Closed
wants to merge 4 commits into from
Closed

Singletons #7575

wants to merge 4 commits into from

Conversation

Noviny
Copy link
Contributor

@Noviny Noviny commented May 31, 2022

This pull request introduces Singletons as a new feature for configuring global, editable database entries when it's not necessary to have more than one representation of the schema (aka, not a normal list).

Singletons can be useful for things like:

  • System Settings
  • Homepage Layout
  • Site Navigation

Before this feature, developers could write a typical schema for a list, and then using Keystone hooks limit the number of items within that list to approximate this functionality.
Unfortunately the GraphQL schema didn't reflect these constraints, and neither did the AdminUI.

This pull requests brings that functionality native to Keystone's schema configuration as a first class primitive.

Tasks

  • Add enforcement of the databases (where able) to ensure that the singleton list only ever has one item
  • Alter the graphql layer so that queries on singletons make more sense (remove querying for multiple items, remove the ‘where’ query on fetching a single item, as there will only ever be one)
  • Update the Admin UI - mostly subtractive changes to give a good experience for singletons where navigating items UI is removed, removing clicks

@vercel
Copy link

vercel bot commented May 31, 2022

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

Name Status Preview Updated
keystone-next-docs ❌ Failed (Inspect) Aug 24, 2022 at 11:58PM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented May 31, 2022

⚠️ No Changeset found

Latest commit: dbd9701

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel vercel bot temporarily deployed to Preview May 31, 2022 08:07 Inactive
@mattJurz
Copy link

I am really looking forward to this feature. Are you able to estimate when singletons will be available in keystone?

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 28, 2022

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 8424dfa:

Sandbox Source
@keystone-6/sandbox Configuration

@vercel vercel bot temporarily deployed to Preview June 28, 2022 11:36 Inactive
@vercel vercel bot temporarily deployed to Preview June 29, 2022 03:41 Inactive
@vercel vercel bot temporarily deployed to Preview June 30, 2022 06:20 Inactive
@vercel vercel bot temporarily deployed to Preview June 30, 2022 09:37 Inactive
@vercel vercel bot temporarily deployed to Preview June 30, 2022 09:57 Inactive
@vercel vercel bot temporarily deployed to Preview July 1, 2022 01:58 Inactive
@vercel vercel bot temporarily deployed to Preview July 1, 2022 02:34 Inactive
@vercel vercel bot temporarily deployed to Preview July 4, 2022 02:05 Inactive
@vercel vercel bot temporarily deployed to Preview July 6, 2022 05:11 Inactive
@vercel vercel bot temporarily deployed to Preview July 7, 2022 02:38 Inactive
@vercel vercel bot temporarily deployed to Preview July 7, 2022 06:24 Inactive
@vercel vercel bot temporarily deployed to Preview July 7, 2022 23:56 Inactive
@vercel vercel bot temporarily deployed to Preview July 11, 2022 02:54 Inactive
@vercel vercel bot temporarily deployed to Preview July 11, 2022 05:02 Inactive
@vercel vercel bot temporarily deployed to Preview July 11, 2022 05:59 Inactive
@vercel vercel bot temporarily deployed to Preview July 11, 2022 07:20 Inactive
@vercel vercel bot temporarily deployed to Preview July 11, 2022 23:15 Inactive
@vercel vercel bot temporarily deployed to Preview July 12, 2022 01:39 Inactive
@vercel vercel bot temporarily deployed to Preview July 13, 2022 04:56 Inactive
@vercel vercel bot temporarily deployed to Preview August 23, 2022 07:16 Inactive
@emmatown emmatown force-pushed the minimal-rename-lists-to-models branch from 038ebc8 to 768c0b5 Compare August 23, 2022 07:16
@vercel vercel bot temporarily deployed to Preview August 23, 2022 23:28 Inactive
@vercel vercel bot temporarily deployed to Preview August 24, 2022 01:37 Inactive
@vercel vercel bot temporarily deployed to Preview August 24, 2022 06:55 Inactive
@vercel vercel bot temporarily deployed to Preview August 24, 2022 23:53 Inactive
@vercel vercel bot temporarily deployed to Preview August 24, 2022 23:58 Inactive
@emmatown emmatown force-pushed the minimal-rename-lists-to-models branch 5 times, most recently from 24a89d5 to f9c4d1d Compare August 25, 2022 03:11
@emmatown emmatown force-pushed the minimal-rename-lists-to-models branch 2 times, most recently from b472b95 to c288f6f Compare August 29, 2022 00:28
Base automatically changed from minimal-rename-lists-to-models to admin-meta-graphql-refactoring August 29, 2022 06:25
Base automatically changed from admin-meta-graphql-refactoring to main August 29, 2022 06:41
@Noviny
Copy link
Contributor Author

Noviny commented Sep 7, 2022

Replaced by #7863

@Noviny Noviny closed this Sep 7, 2022
@dcousens dcousens deleted the singleton branch September 7, 2022 05:22
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.

5 participants