Skip to content

Commit 036c47c

Browse files
fixes message props to alert when passed empty strings
1 parent 11989d5 commit 036c47c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: src/ui/buttons/props.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ export function normalizeButtonMessage(
760760
}
761761
}
762762

763-
if (offer) {
763+
if (offer || typeof offer === "string") {
764764
if (!Array.isArray(offer)) {
765765
throw new TypeError(
766766
`Expected message.offer to be an array of strings, got: ${String(
@@ -776,15 +776,18 @@ export function normalizeButtonMessage(
776776
}
777777
}
778778

779-
if (color && !values(MESSAGE_COLOR).includes(color)) {
779+
if (color === "" || (color && !values(MESSAGE_COLOR).includes(color))) {
780780
throw new Error(`Invalid color: ${color}`);
781781
}
782782

783-
if (position && !values(MESSAGE_POSITION).includes(position)) {
783+
if (
784+
position === "" ||
785+
(position && !values(MESSAGE_POSITION).includes(position))
786+
) {
784787
throw new Error(`Invalid position: ${position}`);
785788
}
786789

787-
if (align && !values(MESSAGE_ALIGN).includes(align)) {
790+
if (align === "" || (align && !values(MESSAGE_ALIGN).includes(align))) {
788791
throw new Error(`Invalid align: ${align}`);
789792
}
790793

0 commit comments

Comments
 (0)