Skip to content

Orderable deletes all data on collection with versions enabled #12097

Closed
@VeiaG

Description

@VeiaG

Describe the Bug

When i enabled orderable on collection with existing data and versions enabled , after trying to reorder , i get this error:

Image

Details:

Image

Image

After , i reloaded page and tried to order collection again ,it worked mostly without error , order was changed after few tries. After reloading again , all data in reordered document is gone.

Image

on my test repo , it doesn't matter if changes are published or not , all data gone ( new version in drafts with all fields empty).

Image

Link to the code that reproduces this issue

https://github.com/VeiaG/orderable-data-bug

Reproduction Steps

  • pnpm dev _community
  • Add versions and access to collection ( access function from docs )
versions: {
    maxPerDoc: 5,
    drafts: true,
  },
  // orderable: true,
  access: {
    read: ({ req }) => {
      if (req.user) {
        return true
      }
      return {
        or: [
          {
            _status: {
              equals: 'published',
            },
          },
          {
            _status: {
              exists: false,
            },
          },
        ],
      }
    },
  },
  • Add some data to collection
  • Enable orderable , and try to order things
  • After successful reordering , refresh page to see that all data is gone.

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Payload: last from `main`
Next.js: same
Node.js: v20.18.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions