Skip to content

Commit 3ce9690

Browse files
committed
fix(next): conditionally query snapshot field based on localization
The snapshot field only exists in version schemas when localization is enabled. The Versions view was unconditionally querying this field, causing "path cannot be queried: snapshot" errors for collections without localization (e.g., trash tests). This aligns with the existing pattern at lines 53-59 in the same file.
1 parent 418bb92 commit 3ce9690

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

packages/next/src/views/Versions/index.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ export async function VersionsView(props: DocumentViewServerProps) {
101101
},
102102
status: 'published',
103103
user,
104-
where: {
105-
snapshot: {
106-
not_equals: true,
107-
},
108-
},
104+
where: localization
105+
? {
106+
snapshot: {
107+
not_equals: true,
108+
},
109+
}
110+
: undefined,
109111
})
110112
: Promise.resolve(null),
111113
draftsEnabled
@@ -127,11 +129,13 @@ export async function VersionsView(props: DocumentViewServerProps) {
127129
},
128130
status: 'draft',
129131
user,
130-
where: {
131-
snapshot: {
132-
not_equals: true,
133-
},
134-
},
132+
where: localization
133+
? {
134+
snapshot: {
135+
not_equals: true,
136+
},
137+
}
138+
: undefined,
135139
})
136140
: Promise.resolve(null),
137141
])

0 commit comments

Comments
 (0)