Record position is not being updated unless I clear the environmentâs cache, and this is now happening across multiple projects. This is breaking a lot of my production sites right now, as I have to manually go in and clear the cache for every build that affects record position.
This was first noticed by a client last week. Prior to this, they were able to reorder records without issue. There were no code updates to the front end in between record ordering working and not working.
I have used Dato for quite a few projects now, with Gatsby on the front end, and this is the first time Iâve encountered this issue. I am using gatsby-source-datocms, and this problem is happening in both local dev environment and in production on Netlify.
How are you clearing the cache manually?
Could you also send us an example of a stale request response you received at support@datocms.com so we can take a closer look at it and try to identify the problem?
The bug was first noticed on a site running gatsby 3.11.1 and gatsby-source-datocms 2.6.16. I upgraded to the latest versions, gatsby 4.24.4 and gatsby-source-datocms 4.0.4, and the bug still occurred.
The other site that I tested and confirmed the bug on was running gatsby 4.16.0 and gatsby-source-datocms 4.0.4.
In these cases, I have only changed the position.
An interesting thing that happens in development is that the change is detected when the positions are changed, and gatsby appears to update, but the data stays as it was prior to the change:
success detected change in DatoCMS content, loading new data - 0.305s
success building schema - 0.852s........
If I then change some other data in the record, then the whole record updates as expected, including the new position. BUT the position values for the other records do not update, so I end up with stale position values for all the other records of that type.
Edit: I have tested a third site and the bug occurs on sortable records there as well, running latest package versions.
Testing with v4.0.5, however, I am only seeing a partial fix. If I change the order of a record, now the âpositionâ value is properly updated for every record except for the record that I moved.
For example, if I build the site and run the query on following record:
Hi @s.verna, I am using npm so itâs a package-lock file, but the exact versions are:
âgatsbyâ: â^4.24.7â,
âgatsby-source-datocmsâ: â^4.0.5â,
The project ID that the lasts tests were run on is #45951.
To reproduce, you first need to run gatsby develop, and then after the project is running locally, change the order of a record. You should see the order update for all records except for the one that was moved. Running gatsby clean and Restarting dev environment will make everything appear correctly again (* No longer need to run clean, simply rerunning develop works).
EDIT: It looks like the bug is now fixed in production as well, and is only persisting in development with Gatsbyâs hot reloading.