Skip to content

Commit d5f934f

Browse files
committed
chore: update history to include initial viewport detection
1 parent aced688 commit d5f934f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • packages/core/components/Puck/components/Canvas

packages/core/components/Puck/components/Canvas/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export const Canvas = () => {
197197
if (iframe.enabled) {
198198
const s = appStoreApi.getState();
199199

200-
appStoreApi.setState({
200+
const appState = {
201201
state: {
202202
...s.state,
203203
ui: {
@@ -213,7 +213,15 @@ export const Canvas = () => {
213213
},
214214
},
215215
},
216-
});
216+
};
217+
218+
let history = s.history;
219+
220+
if (s.history.histories.length === 1) {
221+
history = { ...history, histories: [appState] };
222+
}
223+
224+
appStoreApi.setState({ ...appState, history });
217225
}
218226
}, [viewportOptions, frameRef.current, iframe, appStoreApi]);
219227

0 commit comments

Comments
 (0)