-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
The following code would not work as intended:
const answer = await UIAlert({
message: `Press "yes" to perform dangerous action!`,
buttons: [
{
label: i18n('yes'),
value: true,
},
{
label: i18n('no'),
value: false,
},
]
});
if ( answer ) do_dangerous_action();Regardless of which button the user presses, do_dangerous_action() is called. This is because value is stringified unnecessarily. Instead of the value false, we get the value "false", which is truthy.
Metadata
Metadata
Assignees
Labels
No labels