Skip to content

Commit f34720a

Browse files
committed
docs: added to migration guide
1 parent 63e944c commit f34720a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

docs/migration-guide/v4.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,31 @@ export const myRichTextAdapter = (): RichTextAdapterProvider => {
325325

326326
The `transactionIDPromise` property on `PayloadRequest` has been removed. It was deprecated and unused — `transactionID` (which already supports `Promise<number | string>`) is the correct property to use for both resolved values and pending transactions.
327327

328+
### `defaults` config export removed from `payload` ([#17103](https://github.com/payloadcms/payload/pull/17103))
329+
330+
The `defaults` object exported from `payload` has been removed. It was deprecated because it was a single shared object — mutating it (or any config that used it as a base) leaked changes into every other consumer of the defaults.
331+
332+
```diff
333+
- import { defaults } from 'payload'
334+
-
335+
- const config = {
336+
- ...defaults,
337+
- // your overrides
338+
- }
339+
```
340+
341+
You no longer need to apply defaults yourself. `buildConfig` already fills in every default value during config initialization, so pass only the properties you want to override:
342+
343+
```ts
344+
import { buildConfig } from 'payload'
345+
346+
export default buildConfig({
347+
// only your overrides — defaults are applied automatically
348+
})
349+
```
350+
351+
If you depended on reading a specific default value at runtime, read it from the sanitized config returned by `buildConfig` (or `payload.config`) instead of from the static `defaults` object.
352+
328353
### Plugin Import/Export: `toCSV` and `fromCSV` removed
329354

330355
The `toCSV` and `fromCSV` field options in `custom['plugin-import-export']` have been removed. Use `hooks.beforeExport` and `hooks.beforeImport` instead — they work for both CSV and JSON formats.

0 commit comments

Comments
 (0)