Repository navigation
Conversation
|
Any updates on this? |
f0b6204 to
c2b3201
Compare
|
It looks that the CI issue has been fixed. I've rebased the latest 3.x code and pushed it. |
So basically just need review from @AlessioGr , @JarrodMFlesch and @jacobsfletch it seems? :) 🤞 This behaviour has been reported quite heavily from our colleagues using payloadcms, which is why I requested an update. Sorry for the intrusion :D |
|
Any news? |
c2b3201 to
110d5ec
Compare
|
Hi team, I've rebased this branch onto latest 3.x to refresh the PR and re-trigger the CI checks. Whenever someone has a moment, could you please approve the workflow run? Thanks! |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Hi @denolfe, thanks for triaging this with the v3 label. Following up here since the previous CI run expired waiting for workflow approval—before I rebase again to re-trigger the checks, are you still merging community bug fixes into 3.x right now (or has focus shifted to v4)? Happy to update the branch if this is on your radar to merge. |
What?
This PR fixes two bugs in Payload CMS related to how global configurations are looked up in the Admin UI and the Next.js views:
TypeError) when copying localized data from one locale to another on a Global.queries (returning draft content when published was expected).
Why?
copyDataFromLocale.ts, the code looked up global fields usingglobals[globalSlug].config.fields. However,payload.globalsonly contains the database model instances or initial states and is not keyed by slug with configurations, leading to a crash.fetchVersions.ts, the logic checked if versions were enabled on the entity usingreq.payload.globals[globalSlug]?.config. Becausereq.payload.globalsis not structured this way, the configuration returnedundefined(falsy). As a result, the code incorrectly assumed drafts/versions were disabled for all globals, causing version queries to bypass status-based filtering.How?
packages/ui/src/utilities/copyDataFromLocale.tsto retrieve the global configuration correctly usingpayload.config.globals.find((g) => g.slug === globalSlug)?.fields.packages/next/src/views/Version/fetchVersions.tsto locate the global configuration viareq.payload.config.globals.find((g) => g.slug === globalSlug).should copy global data to another localeintest/localization/int.spec.ts(using a new test globalglobal-copy-test) to prevent regressions on copy-locale operations for globals.should retrieve the latest published version of a globalintest/versions/int.spec.tsusing
simpleDraftGlobalSlugto ensure version querying fetches correct published drafts on globals.Fixes #16747