Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliodiez committed Nov 16, 2024
1 parent bed1935 commit a13061d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/core/providers/canvas/canvas.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export interface CanvasContextModel {
setActivePage: (pageId: string) => void;
deletePage: (pageIndex: number) => void;
editPageTitle: (pageIndex: number, newName: string) => void;
activePageIndex: number;
isThumbnailContextMenuVisible: boolean;
setIsThumbnailContextMenuVisible: React.Dispatch<
React.SetStateAction<boolean>
Expand Down
1 change: 1 addition & 0 deletions src/core/providers/canvas/canvas.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export const CanvasProvider: React.FC<Props> = props => {
setActivePage,
deletePage,
editPageTitle,
activePageIndex: document.activePageIndex,
isThumbnailContextMenuVisible,
setIsThumbnailContextMenuVisible,
}}
Expand Down
8 changes: 5 additions & 3 deletions src/pods/thumb-pages/components/thumb-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Props {
export const ThumbPage: React.FunctionComponent<Props> = props => {
const { pageIndex, onSetActivePage, setPageTitleBeingEdited, isVisible } =
props;
const { fullDocument } = useCanvasContext();
const { fullDocument, activePageIndex } = useCanvasContext();
const page = fullDocument.pages[pageIndex];
const shapes = page.shapes;
const fakeShapeRefs = useRef<ShapeRefs>({});
Expand Down Expand Up @@ -58,8 +58,10 @@ export const ThumbPage: React.FunctionComponent<Props> = props => {
}, [isVisible]);

React.useEffect(() => {
handleResizeAndForceRedraw();
}, [shapes, fullDocument]);
setTimeout(() => {
handleResizeAndForceRedraw();
}, 100);
}, [shapes, activePageIndex]);

React.useEffect(() => {
window.addEventListener('resize', handleResizeAndForceRedraw);
Expand Down

0 comments on commit a13061d

Please sign in to comment.