From 7dd17292a7ee30deec17d841782c8c41419a7ed4 Mon Sep 17 00:00:00 2001 From: WofWca Date: Wed, 8 Jan 2025 21:00:27 +0400 Subject: [PATCH] perf: don't re-render on every window resize --- CHANGELOG.md | 1 + packages/frontend/src/ScreenController.tsx | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21c5ae8834..8e8c5b6393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - fix reactions to sticker messages overlapping with next message #4433 - fix: "Enter" not adding the first contact in "Add Members" dialog #4439 - fix: devmode: fix logging and counting jsonrpc requests #4458 +- performance: don't re-render every time the window is resized #4460 ## [1.50.1] - 2024-12-18 diff --git a/packages/frontend/src/ScreenController.tsx b/packages/frontend/src/ScreenController.tsx index 94a6af308f..bf189bc285 100644 --- a/packages/frontend/src/ScreenController.tsx +++ b/packages/frontend/src/ScreenController.tsx @@ -237,7 +237,10 @@ export default class ScreenController extends Component { } updateSmallScreenMode() { - this.setState({ smallScreenMode: isSmallScreenMode() }) + const newIsSmallScreen = isSmallScreenMode() + if (this.state.smallScreenMode !== newIsSmallScreen) { + this.setState({ smallScreenMode: newIsSmallScreen }) + } } componentDidMount() {