From b3d3b8ba0f7e78cc876d1bca9923b263d3460f90 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 12 Aug 2022 08:19:52 -0500 Subject: [PATCH] fix: Stop multiple buttons from compounding in the workspace action dropdown (#3482) The variadic function on an object doesn't clone the inner array. This was causing the `secondary` property to accumulate more and more button types as time went on! Fixes #3154. --- site/src/components/WorkspaceActions/WorkspaceActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/components/WorkspaceActions/WorkspaceActions.tsx b/site/src/components/WorkspaceActions/WorkspaceActions.tsx index b800e35a79..92c72c0033 100644 --- a/site/src/components/WorkspaceActions/WorkspaceActions.tsx +++ b/site/src/components/WorkspaceActions/WorkspaceActions.tsx @@ -68,7 +68,7 @@ export const WorkspaceActions: FC = ({ // if an update is available, we make the update button the primary CTA // and move the former primary CTA to the secondary actions list const updatedActions = { ...WorkspaceStateActions[workspaceState] } - updatedActions.secondary.unshift(updatedActions.primary) + updatedActions.secondary = [updatedActions.primary, ...updatedActions.secondary] updatedActions.primary = ButtonTypesEnum.update return updatedActions