From 3fd4c9944eef27860179976b2c6edeb8c6e8c55b Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 28 Jan 2026 22:18:24 -0500 Subject: [PATCH 1/2] Optimization: Avoid scheduling updates for Panels unnecessarily (#638) Related to #637 --- CHANGELOG.md | 4 ++++ lib/components/group/Group.tsx | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75b53640f..c399998bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- [638](https://github.com/bvaughn/react-resizable-panels/pull/638): `Panel` avoids unnecessary re-renders in response to mouse-hover state. + ## 4.5.3 - [635](https://github.com/bvaughn/react-resizable-panels/pull/635): Expand pre-collapsed panels if drug past the halfway point for more consistent collapse/expand behavior. diff --git a/lib/components/group/Group.tsx b/lib/components/group/Group.tsx index dd16ce7a0..a96e4a420 100644 --- a/lib/components/group/Group.tsx +++ b/lib/components/group/Group.tsx @@ -233,12 +233,23 @@ export function Group({ } } + let prevInteractionStateActive = false; + const removeInteractionStateChangeListener = eventEmitter.addListener( "interactionStateChange", - () => { - inMemoryValues.panels.forEach((panel) => { - panel.scheduleUpdate(); - }); + (interactionState) => { + const nextInteractionStateActive = interactionState.state === "active"; + if (prevInteractionStateActive !== nextInteractionStateActive) { + prevInteractionStateActive = nextInteractionStateActive; + + // The only reason to schedule a re-render in response to this event type + // is to disable pointer-events within a Panel while a drag is in progress + // (This is done to prevent text from being selected, etc) + // Unnecessary updates should be very fast in this case but we can still avoid them + inMemoryValues.panels.forEach((panel) => { + panel.scheduleUpdate(); + }); + } } ); From 71fc5e36d4a542d74ad5d07d40d2e201b1c809a4 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 28 Jan 2026 22:19:06 -0500 Subject: [PATCH 2/2] 4.5.3 -> 4.5.4 --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c399998bf..e94308085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 4.5.4 - [638](https://github.com/bvaughn/react-resizable-panels/pull/638): `Panel` avoids unnecessary re-renders in response to mouse-hover state. diff --git a/package.json b/package.json index f2d11d2b7..329332ec5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-resizable-panels", - "version": "4.5.3", + "version": "4.5.4", "type": "module", "author": "Brian Vaughn (https://github.com/bvaughn/)", "contributors": [