Dynamic zone components change their id

System Information
  • Strapi Version: 3.6.2
  • Operating System: doesn’t matter
  • Database: Postgresql
  • Node Version: 12.16.1
  • NPM Version: 6.13.4

Hi.

Sometimes I face a strange issue which is extremely hard to reproduce (I still can’t figure out how)

The underlying database is Postgresql. Strapi version is 3.6.2 at the moment, but it was updated a couple of times during development process.

I am talking about components in dynamic zones. These components have id field which is unique for all components of specific type, I suppose. For example there is Post model, inside it there is Content dynamic zone which might include components Text, Picture or Video.

If we query REST API /posts/XXX, then we receive a response like

{
 id: 4,
 Content: [ {
  __component: post.text, id: 10, text: "something"}, {
__component: post.text, id: 11, text: "another text"}, {
__component: post.image, id: 2, ...}
 ]
}

But after some time this response might look like

{
 id: 4,
 Content: [ {
  __component: post.text, id: 12, text: "something"}, {
  __component: post.text, id: 13, text: "another text"}, {
  __component: post.image, id: 2, ...}
 ]
}

Inner components suddenly got new ids, as if they were recreated. But I can’t reproduce it and can’t say whether it was after editing or after Strapi version updated for instance.

I noticed this only because these ids are used to identify text pieces in 3rd party translation platform. And there are multiple identifiers for the same text piece.
Like

post-4-text-10: something
post-4-text-12: something
post-4-text-11: another text
post-4-text-13: another text

And there is no components with id 10 and 11 in the database itself

I wonder if anybody experienced similar issues. Really can’t say more.