Skip to content

Commit

Permalink
feat: deselect item on viewport change
Browse files Browse the repository at this point in the history
This dodges issues with the overlay syncing during viewport changes.
  • Loading branch information
chrisvxd committed Dec 4, 2024
1 parent 1a8fe48 commit 56e06dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/components/Puck/components/Canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import styles from "./styles.module.css";
import { getClassNameFactory } from "../../../../lib";
import { Preview } from "../Preview";
import { getZoomConfig } from "../../../../lib/get-zoom-config";
import { AppState } from "../../../../types";
import { AppState, UiState } from "../../../../types";
import { Loader } from "../../../Loader";

const getClassName = getClassNameFactory("PuckCanvas", styles);
Expand Down Expand Up @@ -143,9 +143,10 @@ export const Canvas = () => {
zoom: zoomConfig.zoom,
};

const newUi = {
const newUi: UiState = {
...ui,
viewports: { ...ui.viewports, current: uiViewport },
itemSelector: null,
};

setUi(newUi);
Expand Down

0 comments on commit 56e06dc

Please sign in to comment.