Skip to content

Commit cabd5f9

Browse files
committed
Fix the case of missing secondary action
1 parent 41bec3d commit cabd5f9

File tree

1 file changed

+17
-16
lines changed
  • packages/notifications/src/component

1 file changed

+17
-16
lines changed

packages/notifications/src/component/Toast.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,23 @@ export function Toast({ toast, removeToast, getRef }: Props) {
149149
{toast.notification.actions.primary[0].label}
150150
</Button>
151151

152-
{toast.notification.actions.secondary[0] && (
153-
<Button
154-
secondary
155-
small
156-
onClick={() => {
157-
toast.notification.actions.secondary[0].run();
158-
}}
159-
style={{
160-
marginTop: '1rem',
161-
marginLeft: '0.5rem',
162-
lineHeight: 1,
163-
}}
164-
>
165-
{toast.notification.actions.secondary[0].label}
166-
</Button>
167-
)}
152+
{toast.notification.actions.secondary &&
153+
toast.notification.actions.secondary[0] && (
154+
<Button
155+
secondary
156+
small
157+
onClick={() => {
158+
toast.notification.actions.secondary[0].run();
159+
}}
160+
style={{
161+
marginTop: '1rem',
162+
marginLeft: '0.5rem',
163+
lineHeight: 1,
164+
}}
165+
>
166+
{toast.notification.actions.secondary[0].label}
167+
</Button>
168+
)}
168169
</div>
169170
)}
170171
</div>

0 commit comments

Comments
 (0)