From 8250112061f75a7304db9fdb4df2477e47c8ac06 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Fri, 28 Jun 2024 14:47:07 +0100 Subject: [PATCH] Fix empty edit context menu (#4037) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes a case where right clicking on an empty canvas would display the edit menu, even when there was nothing to do in the menu. ### Change Type - [ ] `feature` — New feature - [ ] `improvement` — Product improvement - [ ] `api` — API change - [x] `bugfix` — Bug fix - [ ] `other` — Changes that don't affect SDK users, e.g. internal or .com changes ### Test Plan 1. Right click on the canvas ### Release Notes - Fixes a bug where the context menu would display an empty edit menu. --- packages/tldraw/src/lib/ui/components/menu-items.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/tldraw/src/lib/ui/components/menu-items.tsx b/packages/tldraw/src/lib/ui/components/menu-items.tsx index 7bfe7c576..266da1a15 100644 --- a/packages/tldraw/src/lib/ui/components/menu-items.tsx +++ b/packages/tldraw/src/lib/ui/components/menu-items.tsx @@ -330,6 +330,8 @@ export function DeleteMenuItem() { /** @public @react */ export function EditMenuSubmenu() { + if (!useAnySelectedShapesCount(1)) return null + return (