Help us improve KeystoneJS! ✨Click here to share your thoughts in a 5-minute survey 🙏

Keystone Nextpreview

Release

20th April 2021

"@keystone-next/admin-ui": "14.0.0",
"@keystone-next/admin-ui-utils": "4.0.0",
"@keystone-next/access-control-legacy": "10.0.0",
"@keystone-next/adapter-prisma-legacy": "6.0.0",
"@keystone-next/auth": "21.0.0",
"@keystone-next/benchmarks-legacy": "6.0.0",
"@keystone-next/cloudinary": "4.0.0",
"@keystone-next/document-renderer": "2.0.3",
"@keystone-next/fields": "7.0.0",
"@keystone-next/fields-document": "5.0.0",
"@keystone-next/keystone": "16.0.0",
"@keystone-next/session-store-redis": "2.0.0",
"@keystone-next/server-side-graphql-client-legacy": "4.0.0",
"@keystone-next/test-utils-legacy": "17.0.0",
"@keystone-next/types": "17.0.0",
"@keystone-next/utils-legacy": "9.0.0",

What's New

Improvements to the Lists API

To make the Lists API (i.e context.lists.{List}) more intuitive to use, we deprecated the resolveFields option in favour of two new methods:

1. Specify a string of fields to return with the new query option:

Use this when you want to query for resolved field values (including querying relationships and virtual fields). This replaces the resolveFields: false use case. Now you can query a Post like so:

const [post] = await context.lists.Post.findMany({
where: { slug },
query: `
title
content
image {
src
width
height
}`,
});

2. Return the unresolved item data with read hooks

This replaces the resolveFields: boolean use case. We now have a new set of APIs on context.db.lists.{List} which return unresolved item data from your database (but with read hooks applied). They can be referenced directly or returned from a custom mutation or query in the GraphQL API to be handled by the Field resolvers.

For example, to query for the raw data stored in the database:

const [post] = await context.db.lists.Post.findMany({
where: { slug },
});

You can also view the verbose release notes on GitHub.

On this page

  • Release
  • 20th April 2021
  • What's New
  • Improvements to the Lists API