@24i/bigscreen-sdk 1.0.26-alpha.2451 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.26-alpha.2451",
3
+ "version": "1.0.26",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,11 +34,22 @@ export class ToastService<T extends MinimalToastProps> extends Component<Props<T
34
34
  this.serviceContinue();
35
35
  },
36
36
  } as T);
37
- if (!this.isShowingToast) {
38
- this.appendMount(toastElement, this.rootDivRef);
39
- this.isShowingToast = true;
40
- } else {
41
- this.toastElementBuffer.push(toastElement);
37
+
38
+ // Check if toast element with the same message already exists in stack
39
+ const elementExists = this.toastElementBuffer.find((item) => {
40
+ const { message: newMessage } = toastElement.props;
41
+ const { message } = item.props;
42
+
43
+ return message === newMessage;
44
+ }) !== undefined;
45
+
46
+ if (!elementExists) {
47
+ if (!this.isShowingToast) {
48
+ this.appendMount(toastElement, this.rootDivRef);
49
+ this.isShowingToast = true;
50
+ } else {
51
+ this.toastElementBuffer.push(toastElement);
52
+ }
42
53
  }
43
54
  }
44
55