Fix empty edit context menu (#4037)

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.
This commit is contained in:
Steve Ruiz 2024-06-28 14:47:07 +01:00 committed by GitHub
parent 9d02ca9cbe
commit 8250112061
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -330,6 +330,8 @@ export function DeleteMenuItem() {
/** @public @react */ /** @public @react */
export function EditMenuSubmenu() { export function EditMenuSubmenu() {
if (!useAnySelectedShapesCount(1)) return null
return ( return (
<TldrawUiMenuSubmenu id="edit" label="context-menu.edit" size="small"> <TldrawUiMenuSubmenu id="edit" label="context-menu.edit" size="small">
<GroupMenuItem /> <GroupMenuItem />