Skip to content

Commit

Permalink
Remove state layour comparison from app
Browse files Browse the repository at this point in the history
  • Loading branch information
adammertel committed Nov 22, 2024
1 parent dd80611 commit 1182a0d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/client/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,20 @@ export const App: React.FC = () => {
return theme;
}, [selectedThemeId]);

const stateLayoutWidth: number = useAppSelector(
(state) => state.layout.layoutWidth
);
const stateContentHeight: number = useAppSelector(
(state) => state.layout.contentHeight
);

const [debouncedWidth, debouncedHeight] = useDebounce(useWindowSize(), 50);

useEffect(() => {
if (debouncedHeight > 0) {
const heightContent = debouncedHeight - heightHeader;
if (heightContent !== stateContentHeight) {
dispatch(setContentHeight(heightContent));
}
dispatch(setContentHeight(heightContent));
}
}, [debouncedHeight]);

useEffect(() => {
if (debouncedWidth > 0) {
const layoutWidth = debouncedWidth;

if (layoutWidth !== stateLayoutWidth) {
dispatch(setLayoutWidth(layoutWidth));
}
dispatch(setLayoutWidth(layoutWidth));
const onePercent = layoutWidth / 100;

const separatorXStoragePosition =
Expand Down

0 comments on commit 1182a0d

Please sign in to comment.