Versions not showing/being listed #1581
-
I'm running Payload I've enabled versions on a collection, and see '5 versions found' in the sidebar in the admin. When I click through to the versions listing, the pagination says '1-4 of 4', but no versions are listed. I'm logged in with the initial admin user created as part of setup.
import { CollectionConfig } from 'payload/types';
const Members: CollectionConfig = {
slug: 'members',
auth: true,
admin: {
useAsTitle: 'email',
defaultColumns: ['nameFirst', 'nameLast', 'jobTitle', 'department'],
disableDuplicate: true,
listSearchableFields: ['nameFirst', 'nameLast'],
},
access: {
create: () => true,
read: () => true,
update: () => true,
delete: () => true,
readVersions: () => true,
},
versions: true,
fields: [
{
type: 'row',
fields: [
{
name: 'nameFirst',
type: 'text',
label: 'First name',
index: true,
required: true,
},
{
name: 'nameLast',
type: 'text',
label: 'Last name',
index: true,
required: true,
},
],
},
{
type: 'row',
fields: [
{
name: 'jobTitle',
type: 'text',
},
{
name: 'department',
type: 'text',
},
]
},
],
};
export default Members;
import { buildConfig } from 'payload/config';
import path from 'path';
import Members from './collections/Members';
import Users from './collections/Users';
export default buildConfig({
serverURL: 'http://localhost:3000',
csrf: [
'http://localhost:4000',
],
admin: {
user: Users.slug,
},
collections: [
Members,
Users,
],
typescript: {
outputFile: path.resolve(__dirname, 'payload-types.ts'),
},
graphQL: {
schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
},
}); Am I doing something wrong? Thanks! UpdateI have the same issue with a simpler collection: import { CollectionConfig } from 'payload/types';
const Organisations: CollectionConfig = {
slug: 'organisations',
admin: {
useAsTitle: 'name',
defaultColumns: ['name'],
disableDuplicate: true,
listSearchableFields: ['name'],
},
versions: true,
fields: [
{
type: 'row',
fields: [
{
name: 'name',
type: 'text',
label: 'Name',
index: true,
required: true,
},
],
},
],
};
export default Organisations; |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @DavidOliver, I've been able to recreate the problem. It appears limit is set to 0 by default on the request to the Api made by Payload. Request: Response: If you change the pagination limit "Per page: 10" or append ?limit=10 you should see it working. I'm going to open an issue off the back of your discussion for the Payload team to look at. |
Beta Was this translation helpful? Give feedback.
-
@DavidOliver There has been a commit earlier today that resolves the issue commit #dd04d78 |
Beta Was this translation helpful? Give feedback.
Hi @DavidOliver, I've been able to recreate the problem. It appears limit is set to 0 by default on the request to the Api made by Payload.
Request:
GET /api/draft-posts/versions?locale=en&depth=1&where%5Bparent%5D%5Bequals%5D=638e620497a5b55f0214a1b2 HTTP/1.1
Response:
{"docs":[],"totalDocs":11,"limit":0,"totalPages":1,"page":1,"pagingCounter":1,"hasPrevPage":false,"hasNextPage":false,"prevPage":null,"nextPage":null}
If you change the pagination limit "Per page: 10" or append ?limit=10 you should see it working.
I'm going to open an issue off the back of your discussion for the Payload team to look at.