Data Migration
Puck automatically migrates legacy data payloads on render, transforming any deprecated properties to their latest counterparts as described by Data.
This data migration strategy reduces the number of breaking changes required.
Specifically, Puck will migrate the data when rendering <Puck>
or <Render>
, or calling transformProps
.
Types
Puck exports two types:
Data
, a backwards compatible type that supports all deprecated data shapes still supported.CurrentData
, the latest data shape used by Puck internally.
You'll generally want to use Data
to avoid breaking changes during minor version upgrades, but can use CurrentData
to stay on the bleeding edge.
Manually migrating data
If you manually want to update your data payload to the latest CurrentData
, you can run the migrate
method:
import { migrate } from "@measured/puck";
migrate(legacyData);
Opting out
There is currently no way to opt-out of automatic data migrations.