Skip to content

Commit

Permalink
Fix notification display (#2895)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored and twschiller committed Mar 8, 2022
1 parent 71aa229 commit cd8479c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/pageEditor/ElementWizard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
border-radius: 0 !important;
padding-top: 0.3em;
padding-bottom: 0.3em;
font-size: 0.875rem;
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/utils/notify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ export function showNotification({
}: RequireAtLeastOne<Notification, "message" | "error">): string {
const options = { id, duration };

if (!message) {
message = getErrorMessage(error);
} else if (includeErrorDetails) {
message = message.replace(/[\s.:]$/, ": ") + getErrorMessage(error);
if (error) {
if (!message) {
message = getErrorMessage(error);
} else if (includeErrorDetails) {
message = message.replace(/[\s.:]$/, "") + ": " + getErrorMessage(error);
}
}

duration ??= getMessageDisplayTime(message);
Expand Down

0 comments on commit cd8479c

Please sign in to comment.