Skip to content

Commit

Permalink
Merge pull request #535 from Lemoncode/feature/redraw-thumb
Browse files Browse the repository at this point in the history
fix redraw initial
  • Loading branch information
brauliodiez authored Nov 12, 2024
2 parents 2cb8737 + c38c30b commit d58268f
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 d58268f

Please sign in to comment.