From d3333fd137feea1f32de06569a2a7b701846de4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Tue, 21 Apr 2026 10:51:45 +0400 Subject: [PATCH] Remove unused destructured variable and document the convention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- .../cookies/_components/CategorySection.tsx | 4 ++-- contrib/claude/react-components.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx index 01371ec40..3c380197d 100644 --- a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx +++ b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx @@ -154,8 +154,8 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps) const [updateCategory, isUpdating] = useMutation(updateCategoryMutation); - const [moveCookie, _isMoving] - = useMutation(moveCookieMutation); + const [moveCookie] = + useMutation(moveCookieMutation); const [isEditingCategory, setIsEditingCategory] = useState(false); const [editingCookieIndex, setEditingCookieIndex] = useState(null); diff --git a/contrib/claude/react-components.md b/contrib/claude/react-components.md index 576dd3785..b2d8a406a 100644 --- a/contrib/claude/react-components.md +++ b/contrib/claude/react-components.md @@ -11,6 +11,24 @@ This document describes **how to define and shape** React components in Probo fr | `@probo/ui`, Tailwind, `tailwind-variants`, folders, skeletons, compound modules | [`contrib/claude/ui.md`](ui.md) | | Relay queries, fragments, loaders, `queryRef` | [`contrib/claude/relay.md`](relay.md) | +## Destructuring + +**Never destructure a value you do not use.** If only one element of a tuple or object is needed, stop destructuring at that element or omit the unused keys. Do not assign to `_`-prefixed throwaway names. + +### Do / don't: unused destructured values + +```tsx +// Bad — _isMoving is never read +const [moveCookie, _isMoving] = + useMutation(moveCookieMutation); +``` + +```tsx +// Good — stop at the last element you need +const [moveCookie] = + useMutation(moveCookieMutation); +``` + ## Component shape | Rule | Convention |