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

@@ -34,11 +34,11 @@ Then, render the `RefreshRouteOnSave` component anywhere in your `page.tsx`. Her
```tsx
import { RefreshRouteOnSave } from './RefreshRouteOnSave.tsx'
import { getPayloadHMR } from '@payloadcms/next/utilities'
import { getPayload } from 'payload'
import config from '../payload.config'
export default async function Page() {
const payload = await getPayloadHMR({ config })
const payload = await getPayload({ config })
const page = await payload.findByID({
collection: 'pages',