@inertiaui/modal-react 2.0.2 → 2.0.3
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/inertiaui-modal.js
CHANGED
|
@@ -241,7 +241,7 @@ const ModalStackProvider = ({ children }) => {
|
|
|
241
241
|
const savedBaseUrl = baseUrl;
|
|
242
242
|
baseUrl = null;
|
|
243
243
|
closingToBaseUrlTarget = savedBaseUrl;
|
|
244
|
-
if (savedBaseUrl && typeof window !== "undefined") {
|
|
244
|
+
if (savedBaseUrl && typeof window !== "undefined" && !sameUrlPath(savedBaseUrl, window.location.href)) {
|
|
245
245
|
router.push({
|
|
246
246
|
url: savedBaseUrl,
|
|
247
247
|
preserveScroll: true,
|
|
@@ -742,7 +742,7 @@ const HeadlessModal = forwardRef(
|
|
|
742
742
|
}, [modalContext]);
|
|
743
743
|
const previousIsOpenRef = useRef(void 0);
|
|
744
744
|
useEffect(() => {
|
|
745
|
-
if (modalContext
|
|
745
|
+
if (modalContext != null) {
|
|
746
746
|
if (modalContext.isOpen) {
|
|
747
747
|
onSuccess?.();
|
|
748
748
|
} else if (previousIsOpenRef.current === true) {
|
|
@@ -753,7 +753,7 @@ const HeadlessModal = forwardRef(
|
|
|
753
753
|
}, [modalContext?.isOpen]);
|
|
754
754
|
const [rendered, setRendered] = useState(false);
|
|
755
755
|
useEffect(() => {
|
|
756
|
-
if (rendered && modalContext
|
|
756
|
+
if (rendered && modalContext != null && modalContext.isOpen) {
|
|
757
757
|
if (modalContext.onTopOfStack) {
|
|
758
758
|
onFocus?.();
|
|
759
759
|
} else {
|