A unique field on a component of a single-type leads to a faulty 'uniqueness check' #16918
Labels
fix:5
Fixed in Strapi 5
issue: bug
Issue reporting a bug
severity: medium
If it breaks the basic use of the product but can be worked around
source: core:database
Source is core/database package
source: core:strapi
Source is core/strapi package
status: confirmed
Confirmed by a Strapi Team member or multiple community members
Bug report
Required System information
Describe the bug
A unique field on a component of a single-type leads to a faulty 'uniqueness check'
Steps to reproduce the behaviour
At this point error gets displayed saying the value in the unique field of the component is not unique, even though it is.
Expected behavior
After the steps above, the single-type should be able save, because the unique field's value is unique.
Idea
I might be very well wrong, but to me it looks like on the update() of the single-type, the 'uniqueness check' for the unique field does not only look at array of components that would result from update, but at the old data merged with the new data. Thus resulting in the error, because the unique value now exists twice, once in the old record of the edited component and once in the new record.
The text was updated successfully, but these errors were encountered: