Repository navigation
Conversation
dvd233
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
September 13, 2026 23:19
nathanlentz
pushed a commit
that referenced
this pull request
Oct 7, 2026
### What? Cache the client field schema map per admin language. ### Why? `getClientSchemaMap` keyed 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's `i18n`, so whichever language filled the cache first was served to everyone. That is why richText fields and fields with a custom `Field` component (rendered through form state) showed labels in another language (#18583). While testing this I found a second piece: `buildClientFieldSchemaMap` sets the translated password/confirm-password labels on a module-level `baseAuthFields` array 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? - Add `i18n.language` to the cache key, the same way `getClientConfig` caches per language. - Build the auth fields as new objects on each call instead of mutating the shared ones. New `getClientSchemaMap.spec.ts`: both tests fail on `main`, and the auth test still fails with only the cache key change. `packages/ui/src/utilities` unit 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 Co-authored-by: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
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?
Keep authenticated and unauthenticated client field schema maps in separate cache entries, with regression coverage for both request orders.
Why?
createUnauthenticatedClientConfigintentionally removes collection field schemas, butgetClientSchemaMapcached maps only by collection/global/widget slug. A limited map cached before the authenticated account request could therefore be reused while building the Account form, leavingrenderFieldwithout the client field it expects and causing the crash reported in #18162.The reverse order could likewise return a map built from the wrong config shape. The cache needs to include the config's authentication state, not just the entity slug.
How?
authenticatedorunauthenticated.createUnauthenticatedClientConfighelper.Fixes #18162
Testing
pnpm exec vitest run --project unit packages/ui/src --no-cache(11 files, 125 tests)pnpm exec prettier --check packages/ui/src/utilities/getClientSchemaMap.ts packages/ui/src/utilities/getClientSchemaMap.spec.tspnpm exec eslint --flag v10_config_lookup_from_file packages/ui/src/utilities/getClientSchemaMap.tspnpm build:uiThe two new tests fail in both request orders without the cache-key change and pass with it.