@astral/ui 4.104.1 → 4.104.2

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.
@@ -83,6 +83,9 @@ export const notify = {
83
83
  });
84
84
  },
85
85
  stop: () => {
86
+ if (!toastId) {
87
+ return;
88
+ }
86
89
  if (initialOptions?.containerId) {
87
90
  toast.dismiss({
88
91
  id: toastId,
@@ -1,9 +1,14 @@
1
- import { NOTIFY_CONTAINER_ID, NOTIFY_STATIC_CONTAINER_ID, } from '../../constants';
1
+ import { NOTIFY_CONTAINER_ID, NOTIFY_STATIC_CONTAINER_ID, notifyClassnames, } from '../../constants';
2
+ const checkHasStackContainer = () => typeof document !== 'undefined' &&
3
+ Boolean(document.querySelector(`.${notifyClassnames.stackHost}`));
2
4
  const getContainerId = ({ containerId, isStatic, }) => {
3
5
  if (containerId) {
4
6
  return containerId;
5
7
  }
6
- return isStatic ? NOTIFY_STATIC_CONTAINER_ID : NOTIFY_CONTAINER_ID;
8
+ if (isStatic && checkHasStackContainer()) {
9
+ return NOTIFY_STATIC_CONTAINER_ID;
10
+ }
11
+ return NOTIFY_CONTAINER_ID;
7
12
  };
8
13
  export const getNotifyOptions = ({ isStatic, containerId, hideProgressBar, autoClose, ...options }) => ({
9
14
  containerId: getContainerId({ containerId, isStatic }),
@@ -86,6 +86,9 @@ exports.notify = {
86
86
  });
87
87
  },
88
88
  stop: () => {
89
+ if (!toastId) {
90
+ return;
91
+ }
89
92
  if (initialOptions?.containerId) {
90
93
  react_toastify_next_1.toast.dismiss({
91
94
  id: toastId,
@@ -2,11 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNotifyOptions = void 0;
4
4
  const constants_1 = require("../../constants");
5
+ const checkHasStackContainer = () => typeof document !== 'undefined' &&
6
+ Boolean(document.querySelector(`.${constants_1.notifyClassnames.stackHost}`));
5
7
  const getContainerId = ({ containerId, isStatic, }) => {
6
8
  if (containerId) {
7
9
  return containerId;
8
10
  }
9
- return isStatic ? constants_1.NOTIFY_STATIC_CONTAINER_ID : constants_1.NOTIFY_CONTAINER_ID;
11
+ if (isStatic && checkHasStackContainer()) {
12
+ return constants_1.NOTIFY_STATIC_CONTAINER_ID;
13
+ }
14
+ return constants_1.NOTIFY_CONTAINER_ID;
10
15
  };
11
16
  const getNotifyOptions = ({ isStatic, containerId, hideProgressBar, autoClose, ...options }) => ({
12
17
  containerId: getContainerId({ containerId, isStatic }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.104.1",
3
+ "version": "4.104.2",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {