From f4240e52296a96f895e801a99622ff132639bedf Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 23 Oct 2024 10:07:31 -0700 Subject: [PATCH] Prevent bg flash on context menu in sidebar --- src-web/components/Sidebar.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src-web/components/Sidebar.tsx b/src-web/components/Sidebar.tsx index 0f1af7ff..8d425bc5 100644 --- a/src-web/components/Sidebar.tsx +++ b/src-web/components/Sidebar.tsx @@ -704,9 +704,15 @@ function SidebarItem({ const handleSubmitNameEdit = useCallback( async (el: HTMLInputElement) => { if (itemModel === 'http_request') { - await updateHttpRequest.mutateAsync({ id: itemId, update: (r) => ({ ...r, name: el.value }) }); + await updateHttpRequest.mutateAsync({ + id: itemId, + update: (r) => ({ ...r, name: el.value }), + }); } else if (itemModel === 'grpc_request') { - await updateGrpcRequest.mutateAsync({ id: itemId, update: (r) => ({ ...r, name: el.value }) }); + await updateGrpcRequest.mutateAsync({ + id: itemId, + update: (r) => ({ ...r, name: el.value }), + }); } setEditing(false); }, @@ -903,8 +909,9 @@ function SidebarItem({ className={classNames( 'w-full flex gap-1.5 items-center h-xs px-1.5 rounded-md focus-visible:ring focus-visible:ring-border-focus outline-0', editing && 'ring-1 focus-within:ring-focus', - isActive && 'bg-surface-highlight text', - !isActive && 'text-text-subtle group-hover/item:text-text active:bg-surface-highlight', + isActive && 'bg-surface-highlight text-text', + !isActive && 'text-text-subtle group-hover/item:text-text', + showContextMenu && '!text-text', // Show as "active" when context menu is open selected && useProminentStyles && '!bg-surface-active', )} >