From 1133529a8dc7891a24e6a8dbf06feb27e7dec277 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 10 Jun 2024 14:15:52 -0300 Subject: [PATCH] Fixed scrollIntoView not working always --- src/frontend/package.json | 2 +- .../profilePictureChooserComponent/index.tsx | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/frontend/package.json b/src/frontend/package.json index c069b9da1..63cbf6503 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -6,7 +6,6 @@ "@headlessui/react": "^1.7.17", "@hookform/resolvers": "^3.3.4", "@million/lint": "^0.0.73", - "react-hotkeys-hook": "^4.5.0", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4", @@ -56,6 +55,7 @@ "react-dom": "^18.2.21", "react-error-boundary": "^4.0.11", "react-hook-form": "^7.51.4", + "react-hotkeys-hook": "^4.5.0", "react-icons": "^5.0.1", "react-laag": "^2.0.5", "react-markdown": "^8.0.7", diff --git a/src/frontend/src/pages/SettingsPage/pages/GeneralPage/components/ProfilePictureForm/components/profilePictureChooserComponent/index.tsx b/src/frontend/src/pages/SettingsPage/pages/GeneralPage/components/ProfilePictureForm/components/profilePictureChooserComponent/index.tsx index 2fc21bedd..4e1544132 100644 --- a/src/frontend/src/pages/SettingsPage/pages/GeneralPage/components/ProfilePictureForm/components/profilePictureChooserComponent/index.tsx +++ b/src/frontend/src/pages/SettingsPage/pages/GeneralPage/components/ProfilePictureForm/components/profilePictureChooserComponent/index.tsx @@ -1,14 +1,8 @@ -import { useEffect, useRef, useState } from "react"; -import useAlertStore from "../../../../../../../../stores/alertStore"; -import { gradients } from "../../../../../../../../utils/styleUtils"; -import useGetProfilePictures from "./hooks/use-get-profile-pictures"; -import { Label } from "../../../../../../../../components/ui/label"; +import { useEffect, useRef } from "react"; import { BACKEND_URL, BASE_URL_API, } from "../../../../../../../../constants/constants"; -import HorizontalScrollFadeComponent from "../../../../../../../../components/horizontalScrollFadeComponent"; -import LoadingComponent from "../../../../../../../../components/loadingComponent"; import Loading from "../../../../../../../../components/ui/loading"; import { cn } from "../../../../../../../../utils/utils"; import { Button } from "../../../../../../../../components/ui/button"; @@ -34,7 +28,7 @@ export default function ProfilePictureChooserComponent({ if (value && ref) { ref.current?.scrollIntoView({ behavior: "smooth", block: "center" }); } - }, [ref]); + }, [ref, value]); return (