From 73ceb250355d5897b795728f99d1870b25c7f670 Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 29 Jun 2022 08:38:09 -0500 Subject: [PATCH] Remove async, set static actions from response and not state variable (#51556) --- .../app/features/commandPalette/CommandPalette.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/public/app/features/commandPalette/CommandPalette.tsx b/public/app/features/commandPalette/CommandPalette.tsx index fe6bb59c5cd..d70b21be277 100644 --- a/public/app/features/commandPalette/CommandPalette.tsx +++ b/public/app/features/commandPalette/CommandPalette.tsx @@ -47,13 +47,11 @@ export const CommandPalette = () => { }); useEffect(() => { - (async () => { - if (isNotLogin) { - setStaticActions(getGlobalActions(navBarTree)); - setActions(staticActions); - } - })(); - // eslint-disable-next-line react-hooks/exhaustive-deps + if (isNotLogin) { + const staticActionsResp = getGlobalActions(navBarTree); + setStaticActions(staticActionsResp); + setActions([...staticActionsResp]); + } }, [isNotLogin, navBarTree]); useEffect(() => {