Repository navigation
refactor!: remove allowLocalizedWithinLocalized compat flag and PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY env var - #16693
Merged
Merged
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
AlessioGr
enabled auto-merge (squash)
May 20, 2026 23:15
paulpopus
approved these changes
May 21, 2026
DanRibbens
reviewed
May 22, 2026
DanRibbens
left a comment
Contributor
There was a problem hiding this comment.
This needs to be added to docs/migration-guide/v4.mdx
AlessioGr
added a commit
that referenced
this pull request
May 22, 2026
Adds all breaking changes docs from my own PRs to the v4 migration doc. | PR | Breaking change | Merged | In v4 migration doc | |----|-----------------|--------|---------------------| | [#16359](#16359) | `feat!` Deleted `@payloadcms/richtext-slate` — Lexical is now the only supported rich text editor | 2026-04-23 | ✅ Added (was missing) | | [#16414](#16414) | `feat!` Removed deprecated `jobs.depth` and `jobs.runHooks` config options | 2026-04-28 | ✅ Added (was missing) | | [#16416](#16416) | `feat!` Removed deprecated `state: 'failed'`/`'succeeded'` job task return shape | 2026-05-01 | ✅ Added (was missing) | | [#16537](#16537) | `feat!` Bumped minimum Next.js version to 16.2.6 | 2026-05-07 | ✅ Added (was missing) | | [#16540](#16540) | `feat!` Bumped minimum Node.js version to 24.15.0 | 2026-05-08 | ✅ Added (was missing) | | [#16546](#16546) | `feat!` Removed croner `sloppyRanges` compatibility setting (stricter cron parsing) | 2026-05-08 | ✅ Added (was missing) | | [#16547](#16547) | `feat!` Removed deprecated `min`/`max` from `relationship`/`upload` fields | 2026-05-08 | ✅ Added (was missing) | | [#16548](#16548) | `feat(richtext-lexical)!` Removed deprecated `HTMLConverterFeature` / `lexicalHTML` | 2026-05-11 | ✅ Added (was missing) | | [#16692](#16692) | `feat!` Bumped minimum TypeScript version to 6.0.3 | 2026-05-20 | ✅ Added (was missing) | | [#16693](#16693) | `refactor!` Removed `allowLocalizedWithinLocalized` compat flag + `PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY` env var | 2026-05-21 | ✅ Added (was missing) |
AlessioGr
added a commit
that referenced
this pull request
Oct 8, 2026
Removes APIs and types that were marked `@deprecated remove in 4.0`,
renames `LexicalEditorProps` per its `@todo`, and removes stale 4.0
`@todo` comments for changes that already landed.
Includes v4 migration guide entries.
## Breaking changes
### `diffMethod` prop removed from Diff components
Custom Diff components (`admin.components.Diff`) no longer receive
`diffMethod`. It was removed from `FieldDiffClientProps` and every
field-specific variant. Payload always passed `'diffWordsWithSpace'`,
and the `react-diff-viewer-continued` dependency it was meant for is
gone.
```diff
export const MyTextDiff: React.FC<TextFieldDiffClientProps> = ({
- diffMethod,
valueFrom,
valueTo,
}) => {
```
### `readOnly` removed from the `useField` return type
`useField` already stopped returning `readOnly`, so it was always
`undefined` at runtime. Read it from the field component's props
instead:
```diff
-export const MyField: TextFieldClientComponent = ({ path }) => {
- const { readOnly, value } = useField({ path })
+export const MyField: TextFieldClientComponent = ({ path, readOnly }) => {
+ const { value } = useField({ path })
```
### `findMigrationDir` removed from `@payloadcms/drizzle`
```diff
- import { findMigrationDir } from '@payloadcms/drizzle'
+ import { findMigrationDir } from 'payload'
```
### `LexicalEditorProps` renamed to `LexicalEditorArgs`
The type describes the arguments of `lexicalEditor()`, not component
props. The shape is unchanged.
```diff
- import type { LexicalEditorProps } from '@payloadcms/richtext-lexical'
+ import type { LexicalEditorArgs } from '@payloadcms/richtext-lexical'
```
## Other changes
- Removed `PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY` from the dev
`next.config.mjs`. The flag was already removed in #16693, so setting it
did nothing.
- Removed the stale `@todo deprecate /types subpath export in 4.0`
comments from the SQLite, D1 and Vercel Postgres adapters. Those subpath
exports are already gone.
- Removed `readOnly` from the `useField` return type in the React hooks
docs.
_Written by AI_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BREAKING
Removes
config.compatibility.allowLocalizedWithinLocalizedand thePAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTYenv var. Sanitize no longer stripslocalized: truefrom fields nested under a localized parent -fieldShouldBeLocalizeddecides this at runtime instead.Who is affected:
compatibility: { allowLocalizedWithinLocalized: true }localized: truenested under a localized parent - end behavior is unchanged (Payload's own code already usesfieldShouldBeLocalized), butfield.localizedis no longer being deleted. Custom plugin/hook code that readsfield.localizeddirectly will now seetruewhere it previously sawundefined.How to migrate:
compatibilityblock from your config. If your Mongo data still has the redundant nested-localized shape, flatten the config and run a data migrationfield.localizedreads in custom code withfieldShouldBeLocalized({ field, parentIsLocalized })frompayload/shared.Why these existed
allowLocalizedWithinLocalized(#7933) was an opt-out for the new auto-stripping behavior, aimed at pre-3.0 Mongo users with data already written under nested-localized configs. Always marked for removal in 4.0.PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTYexisted because of block references. Blocks defined at the top of the config can be referenced from both localized and non-localized parents, but sanitize visits each block only once (_sanitized = true), so whichever parent it sees first locks in the wrong answer for the other. #11207 fixed this by moving the check to runtime viafieldShouldBeLocalized({ field, parentIsLocalized }).Whether we sanitize the localized properties away or not does not have an impact on this functionality. However, we had to set
PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTYin our monorepo to test against sanitization disabled, in order to guarantee correct runtime handling through our tests.Removing
PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTYand making it the default behavior ensures that the behavior users will encounter matches what we have and test for in the payload monorepo.