Skip to content

Commit

Permalink
fix: check if user passed close label is an observable
Browse files Browse the repository at this point in the history
Signed-off-by: Akshat Patel <akshat@live.ca>
  • Loading branch information
Akshat55 committed Apr 24, 2024
1 parent 90af058 commit 797405b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/notification/actionable-notification.component.ts
Expand Up @@ -4,7 +4,7 @@ import {
HostBinding
} from "@angular/core";

import { of } from "rxjs";
import { isObservable, of } from "rxjs";
import { ActionableContent, NotificationVariants } from "./notification-content.interface";
import { I18n } from "carbon-components-angular/i18n";
import { NotificationDisplayService } from "./notification-display.service";
Expand Down Expand Up @@ -76,7 +76,7 @@ export class ActionableNotification extends BaseNotification {
return this._notificationObj;
}
set notificationObj(obj: ActionableContent) {
if (obj.closeLabel) {
if (obj.closeLabel && !isObservable(obj.closeLabel)) {
obj.closeLabel = of(obj.closeLabel);
}
this._notificationObj = Object.assign({}, this.defaultNotificationObj, obj);
Expand Down
4 changes: 2 additions & 2 deletions src/notification/notification.component.ts
Expand Up @@ -7,7 +7,7 @@ import {
import { NotificationContent } from "./notification-content.interface";
import { I18n } from "carbon-components-angular/i18n";
import { NotificationDisplayService } from "./notification-display.service";
import { of } from "rxjs";
import { isObservable, of } from "rxjs";
import { BaseNotification } from "./base-notification.component";

/**
Expand Down Expand Up @@ -56,7 +56,7 @@ export class Notification extends BaseNotification {
return this._notificationObj;
}
set notificationObj(obj: NotificationContent) {
if (obj.closeLabel) {
if (obj.closeLabel && !isObservable(obj.closeLabel)) {
obj.closeLabel = of(obj.closeLabel);
}
this._notificationObj = Object.assign({}, this.defaultNotificationObj, obj);
Expand Down
4 changes: 2 additions & 2 deletions src/notification/toast.component.ts
Expand Up @@ -5,7 +5,7 @@ import {
HostBinding
} from "@angular/core";

import { of } from "rxjs";
import { isObservable, of } from "rxjs";
import { ToastContent } from "./notification-content.interface";
import { NotificationDisplayService } from "./notification-display.service";
import { I18n } from "carbon-components-angular/i18n";
Expand Down Expand Up @@ -51,7 +51,7 @@ export class Toast extends BaseNotification implements OnInit {
* `type` can be one of `"error"`, `"info"`, `"info-square"`, `"warning"`, `"warning-alt"`, or `"success"`
*/
@Input() set notificationObj(obj: ToastContent) {
if (obj.closeLabel) {
if (obj.closeLabel && !isObservable(obj.closeLabel)) {
obj.closeLabel = of(obj.closeLabel);
}
this._notificationObj = Object.assign({}, this.defaultNotificationObj, obj);
Expand Down

0 comments on commit 797405b

Please sign in to comment.