feat: deprecates getPayloadHMR in favor of simpler getPayload (#9249)

Deprecates `getPayloadHMR` and simplifies this pattern into a single
`import { getPayload } from 'payload'`.

We will still retain the exported `getPayloadHMR` but it now will throw
a deprecation warning with instructions for how to migrate.
This commit is contained in:
James Mikrut
2024-11-16 15:30:05 -05:00
committed by GitHub
parent 67ff23a6e2
commit 31b32ef941
58 changed files with 264 additions and 304 deletions

View File

@@ -1,8 +1,8 @@
import configPromise from '@payload-config'
import { getPayloadHMR } from '@payloadcms/next/utilities'
import { getPayload } from 'payload'
export const Page = async ({ params, searchParams }) => {
const payload = await getPayloadHMR({
const payload = await getPayload({
config: configPromise,
})
return <div>test ${payload?.config?.collections?.length}</div>