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.
This commit is contained in:
Kyle Carberry
2022-08-12 08:19:52 -05:00
committed by GitHub
parent 16c12e976e
commit b3d3b8ba0f

View File

@ -68,7 +68,7 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
// if an update is available, we make the update button the primary CTA // if an update is available, we make the update button the primary CTA
// and move the former primary CTA to the secondary actions list // and move the former primary CTA to the secondary actions list
const updatedActions = { ...WorkspaceStateActions[workspaceState] } const updatedActions = { ...WorkspaceStateActions[workspaceState] }
updatedActions.secondary.unshift(updatedActions.primary) updatedActions.secondary = [updatedActions.primary, ...updatedActions.secondary]
updatedActions.primary = ButtonTypesEnum.update updatedActions.primary = ButtonTypesEnum.update
return updatedActions return updatedActions