From d40d282912670d79753123cae0fdd2c306cd652d Mon Sep 17 00:00:00 2001 From: Harshit Singh <73997189+harshit078@users.noreply.github.com> Date: Fri, 7 Mar 2025 19:56:36 +0530 Subject: [PATCH] Added fix to solve the id TypeError (#19810) Co-authored-by: amrit Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Co-authored-by: Tushar Bhatt <95581504+TusharBhatt1@users.noreply.github.com> --- packages/features/tips/Tips.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/features/tips/Tips.tsx b/packages/features/tips/Tips.tsx index 211f854561..7961ec2cdf 100644 --- a/packages/features/tips/Tips.tsx +++ b/packages/features/tips/Tips.tsx @@ -173,9 +173,11 @@ function Tips() { const items = localStorage.getItem("removedTipsIds") || ""; const itemToRemoveIndex = currentItems.findIndex((item) => item.id === id); + if (itemToRemoveIndex === -1) return [...currentItems]; + localStorage.setItem( "removedTipsIds", - `${currentItems[itemToRemoveIndex].id.toString()}${items.length > 0 ? `,${items.split(",")}` : ""}` + `${currentItems[itemToRemoveIndex].id.toString()}${items.length > 0 ? `,${items}` : ""}` ); currentItems.splice(itemToRemoveIndex, 1); return [...currentItems];