Skip to content

Commit 797405b

Browse files
committed
fix: check if user passed close label is an observable
Signed-off-by: Akshat Patel <[email protected]>
1 parent 90af058 commit 797405b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/notification/actionable-notification.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
HostBinding
55
} from "@angular/core";
66

7-
import { of } from "rxjs";
7+
import { isObservable, of } from "rxjs";
88
import { ActionableContent, NotificationVariants } from "./notification-content.interface";
99
import { I18n } from "carbon-components-angular/i18n";
1010
import { NotificationDisplayService } from "./notification-display.service";
@@ -76,7 +76,7 @@ export class ActionableNotification extends BaseNotification {
7676
return this._notificationObj;
7777
}
7878
set notificationObj(obj: ActionableContent) {
79-
if (obj.closeLabel) {
79+
if (obj.closeLabel && !isObservable(obj.closeLabel)) {
8080
obj.closeLabel = of(obj.closeLabel);
8181
}
8282
this._notificationObj = Object.assign({}, this.defaultNotificationObj, obj);

src/notification/notification.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { NotificationContent } from "./notification-content.interface";
88
import { I18n } from "carbon-components-angular/i18n";
99
import { NotificationDisplayService } from "./notification-display.service";
10-
import { of } from "rxjs";
10+
import { isObservable, of } from "rxjs";
1111
import { BaseNotification } from "./base-notification.component";
1212

1313
/**
@@ -56,7 +56,7 @@ export class Notification extends BaseNotification {
5656
return this._notificationObj;
5757
}
5858
set notificationObj(obj: NotificationContent) {
59-
if (obj.closeLabel) {
59+
if (obj.closeLabel && !isObservable(obj.closeLabel)) {
6060
obj.closeLabel = of(obj.closeLabel);
6161
}
6262
this._notificationObj = Object.assign({}, this.defaultNotificationObj, obj);

src/notification/toast.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
HostBinding
66
} from "@angular/core";
77

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

0 commit comments

Comments
 (0)