Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: payloadcms/payload
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.1
Choose a base ref
...
head repository: payloadcms/payload
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.2
Choose a head ref
  • 12 commits
  • 137 files changed
  • 7 contributors

Commits on Nov 19, 2024

  1. Copy the full SHA
    1dc8094 View commit details
  2. docs: update what-is-payload.mdx (#9353)

    ### What? 
    instead of saying "it", wanted to give more context to what goes into
    your Next app folder.
    
    ### Why? 
    clarification
    
    ### How? 
    edited docs
    cusacke authored Nov 19, 2024
    Copy the full SHA
    646a534 View commit details
  3. fix: allow self referencing relationships when adding new collections…

    … to config (#9360)
    
    ### What?
    Unable to add collections to the config dynamically if they reference
    their own collection in a relationship field.
    
    This was discovered while working on the folder view feature which
    dynamically adds collections to your config if it is enabled per
    collection.
    
    ### Why?
    When `sanitizeCollection` runs, it takes the current config. If you are
    sanitizing a collection before adding it to the config, that collection
    cannot have any self referencing relationship fields on it otherwise it
    fails the validRelationships check.
    
    ### How?
    Using a reducer we now initialize the validRelationships variable with
    the incoming collection slug.
    JarrodMFlesch authored Nov 19, 2024
    Copy the full SHA
    4030e21 View commit details

Commits on Nov 20, 2024

  1. fix(next): autosave document rendering (#9364)

    Closes #9242 and #9365. Autosave-enabled documents rendered within a
    drawer were not being properly handled. This was causing multiple draft
    documents to be created upon opening the drawer, as well as an empty
    document returned from the server function, etc.
    jacobsfletch authored Nov 20, 2024
    Copy the full SHA
    9e85be0 View commit details
  2. docs: fix custom component links in admin (#9368)

    ### What?
    Fixes links for custom components in a few places in admin docs.
    
    ### Why?
    To link users to the correct location in the docs.
    
    ### How?
    Changes to `docs/admin/components.mdx` and
    `docs/admin/customizing-css.mdx`
    akhrarovsaid authored Nov 20, 2024
    Copy the full SHA
    568e1a2 View commit details
  3. Copy the full SHA
    ff0386f View commit details
  4. fix: prioritize server rendered Actions in ActionsProvider (#9379)

    ### What?
    Actions were not being re-rendered when router.refresh was called.
    [Discord
    Link](https://discord.com/channels/967097582721572934/1308636510203154462/1308648116031066173)
    
    ### Why?
    They were stored in state and the state was persisting.
    
    ### How?
    Spread the stateful actions and the Actions from props on top of the
    client state actions.
    JarrodMFlesch authored Nov 20, 2024
    Copy the full SHA
    439dcd4 View commit details
  5. Copy the full SHA
    ef37483 View commit details
  6. fix(next): properly sets doc id types when using postgres (#9381)

    Fixes #9351. When using Postgres, doc ids were being treated as a string
    as opposed to a number within the admin panel. This led to issues for
    anything relying on the `docID` from context, such as the join field not
    properly populating initial data when creating new documents, etc.
    jacobsfletch authored Nov 20, 2024
    Copy the full SHA
    07a9125 View commit details
  7. fix(richtext-lexical): use copy of @lexical/markdown that does not in…

    …stall @lexical/code (#9382)
    
    Fixes #9378
    
    We’ve found out that @lexical/markdown imports cannot be reliably
    dynamically imported by Node.js for an unknown reason. Frequently,
    Node.js simply exits before the dynamic import is done.
    
    We’re suspecting the reason for this to be its dependency on
    @lexical/code that installs prism.
    
    This will not only (hopefully) fix the import issue, but also reduce the
    bundle size & compilation speed of richtext-lexical.
    AlessioGr authored Nov 20, 2024
    Copy the full SHA
    5db7e1e View commit details
  8. fix(ui): invalid permissions passed to group and named tab sub-fields (

    …#9366)
    
    Fixes #9363
    
    This fixes the following issues that caused fields to be either hidden,
    or incorrectly set to readOnly in certain configurations:
    - In some cases, permissions were sanitized incorrectly. This PR
    rewrites the sanitizePermissions function and adds new unit tests
    - after a document save, the client was receiving unsanitized
    permissions. Moving the sanitization logic to the endpoint fixes this
    - Various incorrect handling of permissions in our form state endpoints
    / RenderFields
    AlessioGr authored Nov 20, 2024
    Copy the full SHA
    c67291d View commit details
  9. Copy the full SHA
    025d917 View commit details
Showing with 4,650 additions and 498 deletions.
  1. +1 −1 docs/admin/components.mdx
  2. +1 −1 docs/admin/customizing-css.mdx
  3. +1 −1 docs/getting-started/what-is-payload.mdx
  4. +10 −7 docs/migration-guide/overview.mdx
  5. +1 −1 package.json
  6. +1 −1 packages/create-payload-app/package.json
  7. +1 −1 packages/db-mongodb/package.json
  8. +1 −1 packages/db-postgres/package.json
  9. +1 −1 packages/db-sqlite/package.json
  10. +1 −1 packages/db-vercel-postgres/package.json
  11. +1 −1 packages/drizzle/package.json
  12. +1 −1 packages/email-nodemailer/package.json
  13. +1 −1 packages/email-resend/package.json
  14. +1 −1 packages/graphql/package.json
  15. +7 −2 packages/graphql/src/resolvers/collections/docAccess.ts
  16. +3 −3 packages/graphql/src/resolvers/globals/docAccess.ts
  17. +1 −1 packages/live-preview-react/package.json
  18. +1 −1 packages/live-preview-vue/package.json
  19. +1 −1 packages/live-preview/package.json
  20. +1 −1 packages/next/package.json
  21. +2 −2 packages/next/src/utilities/initPage/handleAdminPage.ts
  22. +6 −11 packages/next/src/views/Document/getDocumentPermissions.tsx
  23. +27 −19 packages/next/src/views/Document/index.tsx
  24. +1 −1 packages/payload-cloud/package.json
  25. +1 −1 packages/payload/package.json
  26. +47 −73 packages/payload/src/auth/types.ts
  27. +7 −1 packages/payload/src/collections/config/sanitize.ts
  28. +11 −3 packages/payload/src/collections/operations/docAccess.ts
  29. +11 −3 packages/payload/src/globals/operations/docAccess.ts
  30. +0 −1 packages/payload/src/index.ts
  31. +1,091 −14 packages/payload/src/utilities/sanitizePermissions.spec.ts
  32. +138 −109 packages/payload/src/utilities/sanitizePermissions.ts
  33. +1 −1 packages/plugin-cloud-storage/package.json
  34. +1 −1 packages/plugin-form-builder/package.json
  35. +1 −1 packages/plugin-nested-docs/package.json
  36. +1 −1 packages/plugin-redirects/package.json
  37. +1 −1 packages/plugin-search/package.json
  38. +1 −1 packages/plugin-sentry/package.json
  39. +1 −1 packages/plugin-seo/package.json
  40. +1 −1 packages/plugin-stripe/package.json
  41. +1 −3 packages/richtext-lexical/package.json
  42. +2 −2 packages/richtext-lexical/src/features/blockquote/markdownTransformer.ts
  43. +5 −2 packages/richtext-lexical/src/features/blocks/client/markdownTransformer.ts
  44. +6 −6 packages/richtext-lexical/src/features/blocks/server/markdownTransformer.ts
  45. +7 −2 packages/richtext-lexical/src/features/experimental_table/markdownTransformer.ts
  46. +1 −1 packages/richtext-lexical/src/features/format/bold/markdownTransformers.ts
  47. +1 −1 packages/richtext-lexical/src/features/format/inlineCode/markdownTransformers.ts
  48. +1 −1 packages/richtext-lexical/src/features/format/italic/markdownTransformers.ts
  49. +1 −1 packages/richtext-lexical/src/features/format/strikethrough/markdownTransformers.ts
  50. +2 −1 packages/richtext-lexical/src/features/heading/markdownTransformer.ts
  51. +1 −1 packages/richtext-lexical/src/features/horizontalRule/client/markdownTransformer.ts
  52. +1 −1 packages/richtext-lexical/src/features/horizontalRule/server/markdownTransformer.ts
  53. +2 −2 packages/richtext-lexical/src/features/link/markdownTransformer.ts
  54. +2 −2 packages/richtext-lexical/src/features/lists/checklist/markdownTransformers.ts
  55. +2 −2 packages/richtext-lexical/src/features/lists/orderedList/markdownTransformer.ts
  56. +2 −1 packages/richtext-lexical/src/features/lists/shared/markdown.ts
  57. +2 −2 packages/richtext-lexical/src/features/lists/unorderedList/markdownTransformer.ts
  58. +1 −1 packages/richtext-lexical/src/features/typesClient.ts
  59. +1 −1 packages/richtext-lexical/src/features/typesServer.ts
  60. +0 −1 packages/richtext-lexical/src/index.ts
  61. +1 −1 packages/richtext-lexical/src/lexical-proxy/@lexical-markdown.ts
  62. +8 −2 packages/richtext-lexical/src/lexical/plugins/MarkdownShortcut/index.tsx
  63. +2 −1 packages/richtext-lexical/src/lexical/utils/markdown/createBlockNode.ts
  64. +21 −0 packages/richtext-lexical/src/packages/@lexical/markdown/LICENSE
  65. +223 −0 packages/richtext-lexical/src/packages/@lexical/markdown/MarkdownExport.ts
  66. +436 −0 packages/richtext-lexical/src/packages/@lexical/markdown/MarkdownImport.ts
  67. +439 −0 packages/richtext-lexical/src/packages/@lexical/markdown/MarkdownShortcuts.ts
  68. +484 −0 packages/richtext-lexical/src/packages/@lexical/markdown/MarkdownTransformers.ts
  69. +134 −0 packages/richtext-lexical/src/packages/@lexical/markdown/index.ts
  70. +430 −0 packages/richtext-lexical/src/packages/@lexical/markdown/utils.ts
  71. +4 −3 packages/richtext-lexical/src/utilities/jsx/lexicalMarkdownCopy.ts
  72. +1 −1 packages/richtext-slate/package.json
  73. +1 −1 packages/storage-azure/package.json
  74. +1 −1 packages/storage-gcs/package.json
  75. +1 −1 packages/storage-s3/package.json
  76. +1 −1 packages/storage-uploadthing/package.json
  77. +1 −1 packages/storage-vercel-blob/package.json
  78. +1 −1 packages/translations/package.json
  79. +1 −1 packages/ui/package.json
  80. +15 −4 packages/ui/src/elements/DeleteMany/index.tsx
  81. +4 −2 packages/ui/src/elements/DocumentDrawer/DrawerContent.tsx
  82. +19 −9 packages/ui/src/elements/EditMany/index.tsx
  83. +23 −4 packages/ui/src/fields/Blocks/BlockRow.tsx
  84. +10 −4 packages/ui/src/forms/RenderFields/index.tsx
  85. +1 −1 packages/ui/src/forms/RenderFields/types.ts
  86. +35 −18 packages/ui/src/forms/fieldSchemasToFormState/addFieldStatePromise.ts
  87. +2 −2 packages/ui/src/forms/fieldSchemasToFormState/index.tsx
  88. +3 −8 packages/ui/src/forms/fieldSchemasToFormState/iterateFields.ts
  89. +3 −20 packages/ui/src/forms/fieldSchemasToFormState/renderField.tsx
  90. +1 −6 packages/ui/src/forms/fieldSchemasToFormState/types.ts
  91. +9 −1 packages/ui/src/providers/Actions/index.tsx
  92. +5 −0 packages/ui/src/providers/Selection/index.tsx
  93. +6 −10 packages/ui/src/providers/ServerFunctions/index.tsx
  94. +2 −2 packages/ui/src/utilities/mergeListSearchAndWhere.ts
  95. +0 −3 pnpm-lock.yaml
  96. +2 −1 templates/website/src/app/(frontend)/layout.tsx
  97. +2 −1 templates/website/src/blocks/Form/Component.tsx
  98. +4 −2 templates/website/src/collections/Pages/index.ts
  99. +3 −2 templates/website/src/collections/Posts/index.ts
  100. +3 −1 templates/website/src/components/AdminBar/index.tsx
  101. +2 −3 templates/website/src/components/LivePreviewListener/index.tsx
  102. +2 −1 templates/website/src/components/Media/ImageMedia/index.tsx
  103. +3 −1 templates/website/src/components/Media/VideoMedia/index.tsx
  104. +1 −0 templates/website/src/environment.d.ts
  105. +2 −1 templates/website/src/payload.config.ts
  106. +4 −3 templates/website/src/plugins/index.ts
  107. +2 −1 templates/website/src/utilities/generateMeta.ts
  108. +2 −1 templates/website/src/utilities/getMeUser.ts
  109. +27 −0 templates/website/src/utilities/getURL.ts
  110. +2 −3 templates/website/src/utilities/mergeOpenGraph.ts
  111. +2 −1 templates/with-vercel-website/src/app/(frontend)/layout.tsx
  112. +2 −1 templates/with-vercel-website/src/blocks/Form/Component.tsx
  113. +4 −2 templates/with-vercel-website/src/collections/Pages/index.ts
  114. +3 −2 templates/with-vercel-website/src/collections/Posts/index.ts
  115. +2 −1 templates/with-vercel-website/src/components/AdminBar/index.tsx
  116. +2 −3 templates/with-vercel-website/src/components/LivePreviewListener/index.tsx
  117. +2 −1 templates/with-vercel-website/src/components/Media/ImageMedia/index.tsx
  118. +2 −1 templates/with-vercel-website/src/components/Media/VideoMedia/index.tsx
  119. +1 −0 templates/with-vercel-website/src/environment.d.ts
  120. +2 −1 templates/with-vercel-website/src/payload.config.ts
  121. +4 −3 templates/with-vercel-website/src/plugins/index.ts
  122. +2 −1 templates/with-vercel-website/src/utilities/generateMeta.ts
  123. +2 −1 templates/with-vercel-website/src/utilities/getMeUser.ts
  124. +27 −0 templates/with-vercel-website/src/utilities/getURL.ts
  125. +2 −3 templates/with-vercel-website/src/utilities/mergeOpenGraph.ts
  126. +2 −2 test/_community/payload-types.ts
  127. +126 −0 test/access-control/collections/Regression-1/index.ts
  128. +38 −0 test/access-control/collections/Regression-2/index.ts
  129. +57 −0 test/access-control/config.ts
  130. +126 −0 test/access-control/e2e.spec.ts
  131. +311 −2 test/access-control/payload-types.ts
  132. +66 −27 test/admin/e2e/3/e2e.spec.ts
  133. +3 −4 test/fields-relationship/e2e.spec.ts
  134. +2 −1 test/fields/collections/LexicalLocalized/textToLexicalJSON.ts
  135. +3 −0 test/helpers/e2e/trackNetworkRequests.ts
  136. +2 −2 test/joins/payload-types.ts
  137. +38 −0 test/versions/e2e.spec.ts
2 changes: 1 addition & 1 deletion docs/admin/components.mdx
Original file line number Diff line number Diff line change
@@ -185,7 +185,7 @@ Each Custom Component receives the following props by default:
<Banner type="warning">
<strong>Reminder:</strong>
All Custom Components also receive various other props that are specific component being rendered. See [Root Components](#root-components), [Collection Components](#collection-components), [Global Components](#global-components), or [Field Components](#custom-field-components) for a complete list of all default props per component.
All Custom Components also receive various other props that are specific component being rendered. See [Root Components](#root-components), [Collection Components](./collections#custom-components), [Global Components](./globals#custom-components), or [Field Components](./fields#custom-components) for a complete list of all default props per component.
</Banner>
### Custom Props
2 changes: 1 addition & 1 deletion docs/admin/customizing-css.mdx
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ Here is an example of how you might target the Dashboard View and change the bac

<Banner type="warning">
<strong>Note:</strong>
If you are building [Custom Components](./overview), it is best to import your own stylesheets directly into your components, rather than using the global stylesheet. You can continue to use the [CSS library](#css-library) as needed.
If you are building [Custom Components](./components), it is best to import your own stylesheets directly into your components, rather than using the global stylesheet. You can continue to use the [CSS library](#css-library) as needed.
</Banner>

### Specificity rules
2 changes: 1 addition & 1 deletion docs/getting-started/what-is-payload.mdx
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ keywords: documentation, getting started, guide, Content Management System, cms,

### Instant backend superpowers

No matter what you're building, Payload will give you backend superpowers. It can be installed in one line into any existing Next.js app, and is designed to catapult your development process. Payload takes the most complex and time-consuming parts of any modern web app and makes them simple.
No matter what you're building, Payload will give you backend superpowers. Your entire Payload config can be installed in one line into any existing Next.js app, and is designed to catapult your development process. Payload takes the most complex and time-consuming parts of any modern web app and makes them simple.

### Open source - deploy anywhere, including Vercel

17 changes: 10 additions & 7 deletions docs/migration-guide/overview.mdx
Original file line number Diff line number Diff line change
@@ -66,7 +66,14 @@ For more details, see the [Documentation](https://payloadcms.com/docs/getting-st
pnpm remove express nodemon @payloadcms/bundler-webpack @payloadcms/bundler-vite
```

1. For Payload Cloud users, the plugin has changed.
1. Database Adapter Migrations

_If you have existing data_ and are using the MongoDB or Postgres adapters, you will need to run the database migrations to ensure your database schema is up-to-date.

- [postgres](https://github.com/payloadcms/payload/releases/tag/v3.0.0-beta.39)
- [mongodb](https://github.com/payloadcms/payload/releases/tag/v3.0.0-beta.131)

2. For Payload Cloud users, the plugin has changed.

Uninstall the old package:

@@ -94,7 +101,7 @@ For more details, see the [Documentation](https://payloadcms.com/docs/getting-st
})
```

1. **Optional** sharp dependency
3. **Optional** sharp dependency

If you have upload enabled collections that use `formatOptions`, `imageSizes`, or `resizeOptions`—payload expects to have `sharp` installed. In 2.0 this was a dependency was installed for you. Now it is only installed if needed. If you have any of these options set, you will need to install `sharp` and add it to your payload.config.ts:

@@ -111,10 +118,6 @@ For more details, see the [Documentation](https://payloadcms.com/docs/getting-st
})
```

1. Database Adapter Migrations

If you have existing data and are using the MongoDB or Postgres adapters, you will need to run the database migrations to ensure your database schema is up-to-date. Follow the instructions from the release notes for [postgres](https://github.com/payloadcms/payload/releases/tag/v3.0.0-beta.39) or [mongodb](https://github.com/payloadcms/payload/releases/tag/v3.0.0-beta.131) depending on your chosen adapter.

## Breaking Changes

1. Delete the `admin.bundler` property from your Payload Config. Payload no longer bundles the Admin Panel. Instead, we rely directly on Next.js for bundling.
@@ -979,7 +982,7 @@ export default buildConfig({
- If you have created a custom adapter, the type must now provide a `name` property.
| Service | Package |
| -------------------- |------------------------------------------------------------------------------|
| -------------------- | ---------------------------------------------------------------------------- |
| Vercel Blob | https://github.com/payloadcms/payload/tree/main/packages/storage-vercel-blob |
| AWS S3 | https://github.com/payloadcms/payload/tree/main/packages/storage-s3 |
| Azure | https://github.com/payloadcms/payload/tree/main/packages/storage-azure |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payload-monorepo",
"version": "3.0.1",
"version": "3.0.2",
"private": true,
"type": "module",
"scripts": {
2 changes: 1 addition & 1 deletion packages/create-payload-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-payload-app",
"version": "3.0.1",
"version": "3.0.2",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
2 changes: 1 addition & 1 deletion packages/db-mongodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/db-mongodb",
"version": "3.0.1",
"version": "3.0.2",
"description": "The officially supported MongoDB database adapter for Payload",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/db-postgres/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/db-postgres",
"version": "3.0.1",
"version": "3.0.2",
"description": "The officially supported Postgres database adapter for Payload",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/db-sqlite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/db-sqlite",
"version": "3.0.1",
"version": "3.0.2",
"description": "The officially supported SQLite database adapter for Payload",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/db-vercel-postgres/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/db-vercel-postgres",
"version": "3.0.1",
"version": "3.0.2",
"description": "Vercel Postgres adapter for Payload",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/drizzle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/drizzle",
"version": "3.0.1",
"version": "3.0.2",
"description": "A library of shared functions used by different payload database adapters",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/email-nodemailer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/email-nodemailer",
"version": "3.0.1",
"version": "3.0.2",
"description": "Payload Nodemailer Email Adapter",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/email-resend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/email-resend",
"version": "3.0.1",
"version": "3.0.2",
"description": "Payload Resend Email Adapter",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/graphql",
"version": "3.0.1",
"version": "3.0.2",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
9 changes: 7 additions & 2 deletions packages/graphql/src/resolvers/collections/docAccess.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { Collection, CollectionPermission, GlobalPermission, PayloadRequest } from 'payload'
import type {
Collection,
PayloadRequest,
SanitizedCollectionPermission,
SanitizedGlobalPermission,
} from 'payload'

import { docAccessOperation, isolateObjectProperty } from 'payload'

@@ -12,7 +17,7 @@ export type Resolver = (
context: {
req: PayloadRequest
},
) => Promise<CollectionPermission | GlobalPermission>
) => Promise<SanitizedCollectionPermission | SanitizedGlobalPermission>

export function docAccessResolver(collection: Collection): Resolver {
async function resolver(_, args, context: Context) {
6 changes: 3 additions & 3 deletions packages/graphql/src/resolvers/globals/docAccess.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {
CollectionPermission,
GlobalPermission,
PayloadRequest,
SanitizedCollectionPermission,
SanitizedGlobalConfig,
SanitizedGlobalPermission,
} from 'payload'

import { docAccessOperationGlobal, isolateObjectProperty } from 'payload'
@@ -14,7 +14,7 @@ export type Resolver = (
context: {
req: PayloadRequest
},
) => Promise<CollectionPermission | GlobalPermission>
) => Promise<SanitizedCollectionPermission | SanitizedGlobalPermission>

export function docAccessResolver(global: SanitizedGlobalConfig): Resolver {
async function resolver(_, context: Context) {
2 changes: 1 addition & 1 deletion packages/live-preview-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/live-preview-react",
"version": "3.0.1",
"version": "3.0.2",
"description": "The official React SDK for Payload Live Preview",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/live-preview-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/live-preview-vue",
"version": "3.0.1",
"version": "3.0.2",
"description": "The official Vue SDK for Payload Live Preview",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/live-preview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/live-preview",
"version": "3.0.1",
"version": "3.0.2",
"description": "The official live preview JavaScript SDK for Payload",
"homepage": "https://payloadcms.com",
"repository": {
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@payloadcms/next",
"version": "3.0.1",
"version": "3.0.2",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
4 changes: 2 additions & 2 deletions packages/next/src/utilities/initPage/handleAdminPage.ts
Original file line number Diff line number Diff line change
@@ -51,9 +51,9 @@ export function getRouteInfo({
globalConfig = config.globals.find((global) => global.slug === globalSlug)
}

// If the collection has an ID field, we need to determine the type of the ID field
// If the collection is using a custom ID, we need to determine it's type
if (collectionConfig && payload) {
if (payload.collections?.[collectionSlug]) {
if (payload.collections?.[collectionSlug]?.customIDType) {
idType = payload.collections?.[collectionSlug].customIDType
}
}
17 changes: 6 additions & 11 deletions packages/next/src/views/Document/getDocumentPermissions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {
Data,
DocumentPermissions,
PayloadRequest,
SanitizedCollectionConfig,
SanitizedDocumentPermissions,
@@ -11,7 +10,7 @@ import {
hasSavePermission as getHasSavePermission,
isEditing as getIsEditing,
} from '@payloadcms/ui/shared'
import { docAccessOperation, docAccessOperationGlobal, sanitizePermissions } from 'payload'
import { docAccessOperation, docAccessOperationGlobal } from 'payload'

export const getDocumentPermissions = async (args: {
collectionConfig?: SanitizedCollectionConfig
@@ -26,7 +25,7 @@ export const getDocumentPermissions = async (args: {
}> => {
const { id, collectionConfig, data = {}, globalConfig, req } = args

let docPermissions: DocumentPermissions
let docPermissions: SanitizedDocumentPermissions
let hasPublishPermission = false

if (collectionConfig) {
@@ -58,7 +57,7 @@ export const getDocumentPermissions = async (args: {
_status: 'published',
},
},
}).then(({ update }) => update?.permission)
}).then((permissions) => permissions.update)
}
} catch (error) {
req.payload.logger.error(error)
@@ -85,20 +84,16 @@ export const getDocumentPermissions = async (args: {
_status: 'published',
},
},
}).then(({ update }) => update?.permission)
}).then((permissions) => permissions.update)
}
} catch (error) {
req.payload.logger.error(error)
}
}

// TODO: do this in a better way. Only doing this bc this is how the fn was written (mutates the original object)
const sanitizedDocPermissions = { ...docPermissions } as any as SanitizedDocumentPermissions
sanitizePermissions(sanitizedDocPermissions)

const hasSavePermission = getHasSavePermission({
collectionSlug: collectionConfig?.slug,
docPermissions: sanitizedDocPermissions,
docPermissions,
globalSlug: globalConfig?.slug,
isEditing: getIsEditing({
id,
@@ -108,7 +103,7 @@ export const getDocumentPermissions = async (args: {
})

return {
docPermissions: sanitizedDocPermissions,
docPermissions,
hasPublishPermission,
hasSavePermission,
}
Loading