Skip to content

Commit 119bda1

Browse files
committed
fix: Guard edge case when restarting or applying without more details
1 parent 0332ffb commit 119bda1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/hooks/useApplyLicensesClick.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ export function useApplyLicensesClick({ licenses }: ApplyLicensesClickParams): A
102102
toast.error('Error', {
103103
id: toastId,
104104
description: `${licenseWord} not applied.\n`
105-
+ [
105+
+ ([
106106
licensesApplied > 0 && licenses.length !== licensesApplied && `${licensesApplied} of ${licenses.length} ${licenseWord.toLowerCase()} applied.`,
107-
].filter(excludeFalsy)[0],
107+
].filter(excludeFalsy).shift() || ''),
108108
duration: 10_000,
109109
action: {
110110
label: 'Dismiss',

src/hooks/useRestartClusterClick.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ export function useRestartClusterClick({ onRestartedSuccessfully }: RestartClust
125125
toast.error('Error', {
126126
id: toastId,
127127
description: `Failed to fully restart cluster.\n`
128-
+ [
128+
+ ([
129129
allInstances.length === 0 && 'No instances were found within the cluster to restart.',
130130
instancesRestarted === 0 && `No instances were in a "RUNNING" state of ${allTheInstances}.`,
131131
allInstances.length !== instancesRestarted && `Only ${someRunningInstancesWere} restarted of ${allTheInstances}.`,
132-
].filter(excludeFalsy)[0],
132+
].filter(excludeFalsy).shift() || ''),
133133
duration: 10_000,
134134
action: {
135135
label: 'Dismiss',

0 commit comments

Comments
 (0)