Skip to content

Commit

Permalink
fix redraw initial
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliodiez committed Nov 12, 2024
1 parent 2cb8737 commit c38c30b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pods/thumb-pages/components/thumb-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const ThumbPage: React.FunctionComponent<Props> = props => {
});

const divRef = useRef<HTMLDivElement>(null);
const [key, setKey] = React.useState(0);

React.useEffect(() => {
const newCanvaSize = {
Expand All @@ -48,6 +49,8 @@ export const ThumbPage: React.FunctionComponent<Props> = props => {
setCanvasSize(newCanvaSize);
setFinalScale(calculateScaleBasedOnBounds(shapes, newCanvaSize));

setKey(key => key + 1);

return () => {
window.removeEventListener('resize', () => {
setCanvasSize({
Expand All @@ -72,6 +75,7 @@ export const ThumbPage: React.FunctionComponent<Props> = props => {
className={classes.container}
onClick={() => onSetActivePage(page.id)}
onContextMenu={handleShowContextMenu}
key={key}
>
<Stage
width={canvasSize.width}
Expand Down

0 comments on commit c38c30b

Please sign in to comment.