Republishing a Strapi block schema changed my slot and broke the front end, how do I pin versions?
After I updated a slot's schema to add a field, the deployed app started reading unexpected content because my code was not pinned to any particular version. I would like to understand how slot versions work in Croct, and how to keep the build stable while I iterate on the Strapi side and optimise the schema.
1 answer
What happened is that a slot ID without a version resolves to the latest version, so the moment you publish a schema change it takes effect immediately and can break code that expected the old shape. Pin the version in code, for example home-hero@2, and published changes no longer reach the app silently. You migrate on your own schedule instead.
This is safe because a schema change creates a new version while the old versions keep serving, so nothing you already deployed changes underneath you. On top of that, the CLI generates a slots.d.ts file from your slots. Committing that file keeps your types in sync and avoids a type-generating API fetch at build time, which is what tends to make CI flaky. One thing to keep in mind while you iterate: preview links require the slot versions to match, so a preview will fail if the version in your code and the one in the link differ.
See how slot versioning works and the generated slots.d.ts types for the CLI side.
committing slots.d.ts is what finally fixed our CI too. we had it gitignored and the build hit the API every time, flaked constantly. checked it in, pinned the versions, green ever since. there is a good writeup on how the version specifiers and slots.d.ts play with CI if anyone wants the detail.