From 7d0c83df2ca67de154fc20ff38f1e39bc57201f2 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Thu, 3 Oct 2024 15:58:50 +0530 Subject: [PATCH] Stop duplicate issue layout updates --- .../issue-layouts/filters/header/layout-selection.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/core/components/issues/issue-layouts/filters/header/layout-selection.tsx b/web/core/components/issues/issue-layouts/filters/header/layout-selection.tsx index 0e98520ee24..6eb8a0c6ad0 100644 --- a/web/core/components/issues/issue-layouts/filters/header/layout-selection.tsx +++ b/web/core/components/issues/issue-layouts/filters/header/layout-selection.tsx @@ -6,7 +6,7 @@ import React from "react"; import { Tooltip } from "@plane/ui"; // types // constants -import { EIssueLayoutTypes,ISSUE_LAYOUTS } from "@/constants/issue"; +import { EIssueLayoutTypes, ISSUE_LAYOUTS } from "@/constants/issue"; import { usePlatformOS } from "@/hooks/use-platform-os"; // hooks @@ -20,6 +20,12 @@ export const LayoutSelection: React.FC = (props) => { const { layouts, onChange, selectedLayout } = props; const { isMobile } = usePlatformOS(); + const handleOnChange = (layoutKey: EIssueLayoutTypes) => { + if (selectedLayout !== layoutKey) { + onChange(layoutKey); + } + }; + return (
{ISSUE_LAYOUTS.filter((l) => layouts.includes(l.key)).map((layout) => ( @@ -29,7 +35,7 @@ export const LayoutSelection: React.FC = (props) => { className={`group grid h-[22px] w-7 place-items-center overflow-hidden rounded transition-all hover:bg-custom-background-100 ${ selectedLayout == layout.key ? "bg-custom-background-100 shadow-custom-shadow-2xs" : "" }`} - onClick={() => onChange(layout.key)} + onClick={() => handleOnChange(layout.key)} >