From 203ca36d5a10a58a766aee3b454a81e5ff2d422c Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 10 Mar 2025 18:04:31 -0300 Subject: [PATCH] fix: improve ref naming causing fallback error on icons + regression test (#6989) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ♻️ (index.tsx): remove unused ShortUniqueId import and uid variable to clean up the code 💡 (index.tsx): refactor useEffect dependency array to only include necessary dependencies for better performance and readability ♻️ (index.tsx): refactor PopoverContent component to use notificationRef instead of inline ref assignment for better code organization * ✨ (loading.tsx): add data-testid attribute to loading icon for easier testing and identification in the UI ✅ (general-bugs-icons-fallback.spec.ts): add test to ensure that loading icon fallback is displayed correctly when the icon is not found --- .../src/alerts/alertDropDown/index.tsx | 14 ++++------- src/frontend/src/components/ui/loading.tsx | 1 + .../general-bugs-icons-fallback.spec.ts | 24 +++++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 src/frontend/tests/extended/regression/general-bugs-icons-fallback.spec.ts diff --git a/src/frontend/src/alerts/alertDropDown/index.tsx b/src/frontend/src/alerts/alertDropDown/index.tsx index 3d830f25b..87e2fac56 100644 --- a/src/frontend/src/alerts/alertDropDown/index.tsx +++ b/src/frontend/src/alerts/alertDropDown/index.tsx @@ -1,6 +1,5 @@ import { Cross2Icon } from "@radix-ui/react-icons"; import { forwardRef, useEffect, useState } from "react"; -import ShortUniqueId from "short-unique-id"; import IconComponent from "../../components/common/genericIconComponent"; import { Popover, @@ -31,9 +30,7 @@ const AlertDropdown = forwardRef( if (!open) { onClose?.(); } - }, [open, onClose]); - - const uid = new ShortUniqueId(); + }, [open]); return ( ( > {children} -
+
Notifications