Skip to content

Commit b9d3250

Browse files
authored
chore: migrate outdated @payloadcms/next/utilities imports (#10777)
1 parent 03f7bdf commit b9d3250

File tree

11 files changed

+35
-40
lines changed

11 files changed

+35
-40
lines changed

app/(app)/test/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import configPromise from '@payload-config'
2-
import { getPayloadHMR } from '@payloadcms/next/utilities'
2+
import { getPayload } from 'payload'
33

44
export const Page = async ({ params, searchParams }) => {
5-
const payload = await getPayloadHMR({
5+
const payload = await getPayload({
66
config: configPromise,
77
})
88
return <div>test ${payload?.config?.collections?.length}</div>

docs/rest-api/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ Data is not automatically appended to the request. You can read the body data by
663663
Or you could use our helper function that mutates the request and appends data and file if found.
664664

665665
```ts
666-
import { addDataAndFileToRequest } from '@payloadcms/next/utilities'
666+
import { addDataAndFileToRequest } from 'payload'
667667

668668
// custom endpoint example
669669
{
@@ -689,7 +689,7 @@ import { addDataAndFileToRequest } from '@payloadcms/next/utilities'
689689
The locale and the fallback locale are not automatically appended to custom endpoint requests. If you would like to add them you can use this helper function.
690690

691691
```ts
692-
import { addLocalesToRequestFromData } from '@payloadcms/next/utilities'
692+
import { addLocalesToRequestFromData } from 'payload'
693693

694694
// custom endpoint example
695695
{

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const defaultESLintIgnores = [
2121
'**/temp/',
2222
'**/*.spec.ts',
2323
'next-env.d.ts',
24+
'**/app',
2425
]
2526

2627
/** @typedef {import('eslint').Linter.Config} Config */

packages/payload/src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type PayloadRequestData = {
8383
* use either:
8484
* 1. `const data = await req.json()`
8585
*
86-
* 2. import { addDataAndFileToRequest } from '@payloadcms/next/utilities'
86+
* 2. import { addDataAndFileToRequest } from 'payload'
8787
* `await addDataAndFileToRequest(req)`
8888
* */
8989
data?: JsonObject

packages/plugin-search/src/utilities/generateReindexHandler.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import type { PayloadHandler } from 'payload'
22

3-
import { addLocalesToRequestFromData, headersWithCors } from '@payloadcms/next/utilities'
4-
import { commitTransaction, getAccessResults, initTransaction, killTransaction } from 'payload'
3+
import {
4+
addLocalesToRequestFromData,
5+
commitTransaction,
6+
getAccessResults,
7+
headersWithCors,
8+
initTransaction,
9+
killTransaction,
10+
} from 'payload'
511

612
import type { SearchPluginConfigWithLocales } from '../types.js'
713

packages/plugin-stripe/src/routes/rest.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { PayloadRequest } from 'payload'
22

3-
import { addDataAndFileToRequest } from '@payloadcms/next/utilities'
4-
import { Forbidden } from 'payload'
3+
import { addDataAndFileToRequest, Forbidden } from 'payload'
54

65
import type { StripePluginConfig } from '../types.js'
76

pnpm-lock.yaml

Lines changed: 15 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/buildConfigWithDefaults.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,6 @@ export async function buildConfigWithDefaults(
156156
config.admin = {}
157157
}
158158

159-
config.admin.experimental = {
160-
...(config.admin.experimental || {}),
161-
optimizeFormState: true,
162-
}
163-
164159
if (config.admin.autoLogin === undefined) {
165160
config.admin.autoLogin =
166161
process.env.PAYLOAD_PUBLIC_DISABLE_AUTO_LOGIN === 'true' || options?.disableAutoLogin

test/helpers/reInit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Endpoint, PayloadHandler } from 'payload'
22

3-
import { addDataAndFileToRequest } from '@payloadcms/next/utilities'
4-
import httpStatus from 'http-status'
3+
import { status as httpStatus } from 'http-status'
4+
import { addDataAndFileToRequest } from 'payload'
55

66
import { path } from './reInitializeDB.js'
77
import { seedDB } from './seed.js'

test/helpers/sdk/endpoint.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Endpoint, PayloadHandler } from 'payload'
22

3-
import { addDataAndFileToRequest } from '@payloadcms/next/utilities'
4-
import httpStatus from 'http-status'
3+
import { status as httpStatus } from 'http-status'
4+
import { addDataAndFileToRequest } from 'payload'
55

66
export const handler: PayloadHandler = async (req) => {
77
await addDataAndFileToRequest(req)

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"eslint-plugin-playwright": "2.1.0",
7070
"execa": "5.1.1",
7171
"file-type": "19.3.0",
72-
"http-status": "1.6.2",
72+
"http-status": "2.1.0",
7373
"jest": "29.7.0",
7474
"jwt-decode": "4.0.0",
7575
"mongoose": "8.9.5",

0 commit comments

Comments
 (0)