Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
fix(next): conditionally query snapshot field based on localization (#15693)
# Overview
Fixes a query validation error in the Versions view that occurs when
viewing versions for collections without localization enabled.
## Key Changes
- Made the `snapshot` query conditional on localization in
`fetchLatestVersion` calls
- The `snapshot` field only exists in version schemas when
`config.localization` is enabled
- Collections without localization (e.g., trash tests) would fail with
"The following path cannot be queried: snapshot"
- Aligns with the existing pattern already used earlier in the same file
## Design Decisions
The fix follows the existing pattern in the same file where the
`snapshot` filter is conditionally applied:
```typescript
if (localization && draftsEnabled) {
whereQuery.and.push({ snapshot: { not_equals: true } })
}
```
The two `fetchLatestVersion` calls for `currentlyPublishedVersion` and
`latestDraftVersion` were missing this guard, causing failures when
localization is disabled.
When localization is disabled, no snapshot versions exist anyway, so the
filter is unnecessary. E
Elliot DeNolf committed
d5706ee09b7358401ee99bec592c691291e3d008
Parent: 139cf3e
Committed by GitHub <noreply@github.com>
on 2/26/2026, 9:58:21 PM