Open
Description
When using usePuck with histories, the histories and index params do not update when the root data does. However they do when other data is updated.
<Puck
config={
{
...puckConfig,
root: {
...puckConfig.root,
fields: {
customField: {
label: "The Custom Field",
type: "text",
}
},
defaultProps: {
customField: "Custom Field Default"
},
}
}
}
</Puck>
...
const {
appState,
history: {
histories,
index,
},
} = usePuck() as {
appState: ReturnType<typeof usePuck>["appState"];
history: Omit<ReturnType<typeof usePuck>["history"], "histories"> & {
histories: History<Partial<AppState>>[];
};
};
useEffect(() => {
console.log("useEffect called here");
}, [index, histories]);
When customField is updated, the history and index is not updated. However if another field in puck is updated, then the changes to the customField will be seen in the history along with the other change.