Skip to content

Commit

Permalink
Dialog action button missing keys issue [OKTA-735371] (#2249)
Browse files Browse the repository at this point in the history
OKTA-735371 fix: dialog action button issue OKTA-735371
fix: update
fix: remove react import
Merge branch 'main' into bl_dialog_fix
  • Loading branch information
benlister-okta committed Jun 4, 2024
1 parent 4e5d8ba commit efda111
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/odyssey-react-mui/src/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import {
import { Button } from "./Button";
import { CloseIcon } from "./icons.generated";
import {
cloneElement,
memo,
ReactNode,
useState,
useEffect,
useRef,
ReactElement,
ReactNode,
} from "react";

import type { HtmlProps } from "./HtmlProps";
Expand Down Expand Up @@ -129,7 +130,8 @@ const Dialog = ({
) : (
children
);
//Prioritize new action button format (|| used as a fallback)

// Prioritize new action button format (|| used as a fallback)
const actionButtons = [
tertiaryCallToActionComponent || callToActionLastComponent,
secondaryCallToActionComponent || callToActionSecondComponent,
Expand Down Expand Up @@ -160,7 +162,11 @@ const Dialog = ({
</DialogContent>

{actionButtons.length > 0 && (
<DialogActions>{actionButtons}</DialogActions>
<DialogActions>
{actionButtons.map((actionButton, index) =>
actionButton ? cloneElement(actionButton, { key: index }) : null,
)}
</DialogActions>
)}
</MuiDialog>
);
Expand Down

0 comments on commit efda111

Please sign in to comment.