From 5482792697c96998f074f5bda457f906ed05dd77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 22 Aug 2024 17:32:04 +0200 Subject: [PATCH] Fix scroll on user settings (#28022) --- webapp/channels/src/components/setting_item.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webapp/channels/src/components/setting_item.tsx b/webapp/channels/src/components/setting_item.tsx index 4bc2bdeb6e..89c080c799 100644 --- a/webapp/channels/src/components/setting_item.tsx +++ b/webapp/channels/src/components/setting_item.tsx @@ -2,11 +2,13 @@ // See LICENSE.txt for license information. import type {ReactNode} from 'react'; -import React, {useEffect, useRef} from 'react'; +import React, {useRef} from 'react'; import type SettingItemMinComponent from 'components/setting_item_min'; import SettingItemMin from 'components/setting_item_min'; +import useDidUpdate from './common/hooks/useDidUpdate'; + type Props = { /** @@ -54,7 +56,7 @@ const SettingItem = ({ }: Props) => { const minRef = useRef(null); - useEffect(() => { + useDidUpdate(() => { // We want to bring back focus to the edit button when the section is opened and then closed along with all sections are closed if (!active && areAllSectionsInactive) {