From d62702f7dd7cf9a3c5b72d7734736b9e51e8a564 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Thu, 26 Oct 2023 10:41:14 -0700 Subject: [PATCH] Fix request creation from menu --- src-web/components/EnvironmentActionsDropdown.tsx | 5 +++-- src-web/components/Sidebar.tsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src-web/components/EnvironmentActionsDropdown.tsx b/src-web/components/EnvironmentActionsDropdown.tsx index 54423c2b..f79a26c7 100644 --- a/src-web/components/EnvironmentActionsDropdown.tsx +++ b/src-web/components/EnvironmentActionsDropdown.tsx @@ -34,11 +34,12 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo (e) => ({ key: e.id, label: e.name, + rightSlot: e.id === activeEnvironment?.id ? : undefined, onSelect: async () => { routes.setEnvironment(e); }, }), - [], + [activeEnvironment?.id], ); const activeEnvironmentItems: DropdownItem[] = environments.length <= 1 @@ -99,7 +100,7 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo const name = await prompt({ name: 'name', label: 'Name', - defaultValue: '', + defaultValue: 'My Environment', description: 'Enter a name for the new environment', title: 'Create Environment', }); diff --git a/src-web/components/Sidebar.tsx b/src-web/components/Sidebar.tsx index b2a8062a..bc71621a 100644 --- a/src-web/components/Sidebar.tsx +++ b/src-web/components/Sidebar.tsx @@ -51,7 +51,7 @@ export const Sidebar = memo(function Sidebar({ className }: Props) { const [selectedIndex, setSelectedIndex] = useState(); // TODO: Move these listeners to a central place - useListenToTauriEvent('create_request', async () => createRequest.mutate({})); + useListenToTauriEvent('new_request', async () => createRequest.mutate({})); const focusActiveRequest = useCallback( (forcedIndex?: number) => {