@shoplflow/base 0.24.17 → 0.24.18

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/dist/index.cjs CHANGED
@@ -942,6 +942,15 @@ var ModalProvider = ({ children }) => {
942
942
  document.body.style.cssText = "overflow:unset";
943
943
  };
944
944
  }, [openedModals.length]);
945
+ React2.useEffect(() => {
946
+ const closeAllModals = () => {
947
+ setOpenedModals([]);
948
+ };
949
+ window.addEventListener("popstate", closeAllModals);
950
+ return () => {
951
+ window.removeEventListener("popstate", closeAllModals);
952
+ };
953
+ }, []);
945
954
  return /* @__PURE__ */ jsxRuntime.jsx(exports.ModalContext.Provider, { value: openedModals, children: /* @__PURE__ */ jsxRuntime.jsx(exports.ModalHandlerContext.Provider, { value: dispatch, children }) });
946
955
  };
947
956
  var ModalProvider_default = ModalProvider;