Repository navigation
fix(ui): cache client schema maps per language - #18585
Merged
nathanlentz merged 1 commit intoOct 7, 2026
Merged
Conversation
The client schema map was cached per entity slug only, so labels came out in the language of the first request that filled the cache. Add the language to the cache key, and build the auth fields per call so a map for one language does not rename the password fields of another. Fixes payloadcms#18583 Co-Authored-By: Claude Opus 5.5 <[email protected]>
kaanisthatyou
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
October 7, 2026 12:00
nathanlentz
approved these changes
Oct 7, 2026
nathanlentz
left a comment
Collaborator
There was a problem hiding this comment.
Code looks good and this happens to fix an issue I just ran into from CI in another body of work. I think this bug technically exists server side but that doesn't block this from going through in my opinion.
Thanks for the contribution!
Contributor
|
@nathanlentz should #18583 be reopened, as this issue opened with v3 tag ? Or there is no plans to release this fix to v3 (v4 soon confirmed 😁 ) ? |
Contributor
|
🚀 This is included in version v4.0.0-canary.38 |
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.
What?
Cache the client field schema map per admin language.
Why?
getClientSchemaMapkeyed its process-wide cache by entity slug only. The map is built from the per-language client config and runs label functions with the request'si18n, so whichever language filled the cache first was served to everyone. That is why richText fields and fields with a customFieldcomponent (rendered through form state) showed labels in another language (#18583).While testing this I found a second piece:
buildClientFieldSchemaMapsets the translated password/confirm-password labels on a module-levelbaseAuthFieldsarray and puts those same objects into the map. With per-language maps, building the French map would rename the password fields in the cached English one.How?
i18n.languageto the cache key, the same waygetClientConfigcaches per language.New
getClientSchemaMap.spec.ts: both tests fail onmain, and the auth test still fails with only the cache key change.packages/ui/src/utilitiesunit specs pass (149).#18168 changes the same cache key for auth state; whichever lands second needs a one-line rebase. The same cache key exists on
3.x.Fixes #18583