Problem with order when updating a record linked through a has-many relationship

Required System information

  • Node.js version: 20.16.0
  • NPM version: 10.8.1
  • Strapi version: 5.7.0 and previows
  • Database: postgresql

Describe the bug

In my case, I have two collections: faq_categories and faqs. faq_categories has a has_many relationship with faqs. When I update an faq linked to an faq_category and publish it, the record is destroyed and a new one is created. However, in the join table, the faq_order value for the new record changes it moves to the end of the list.

Steps to reproduce the behavior

  1. Go to related record (ex: faq foo)
  2. Change a field save and publish (ex: answer from ‘foo’ to ‘updated foo’)
  3. Call the APIs to check the order in which they are returned
  4. See that the position are changed

Expected behavior

I expect that updating a record does not change its position and that the sorting remains the same.

Screenshots