@inertiaui/modal-react 3.0.0 → 3.1.0
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
|
@@ -265,7 +265,7 @@ const ModalStackProvider = ({ children }) => {
|
|
|
265
265
|
const savedBaseUrl = baseUrl;
|
|
266
266
|
baseUrl = null;
|
|
267
267
|
closingToBaseUrlTarget = savedBaseUrl;
|
|
268
|
-
if (savedBaseUrl && typeof window !== "undefined") {
|
|
268
|
+
if (savedBaseUrl && typeof window !== "undefined" && !sameUrlPath(savedBaseUrl, window.location.href)) {
|
|
269
269
|
router.push({
|
|
270
270
|
url: savedBaseUrl,
|
|
271
271
|
preserveScroll: true,
|
|
@@ -759,7 +759,7 @@ const HeadlessModal = forwardRef(
|
|
|
759
759
|
}, [modalContext]);
|
|
760
760
|
const previousIsOpenRef = useRef(void 0);
|
|
761
761
|
useEffect(() => {
|
|
762
|
-
if (modalContext
|
|
762
|
+
if (modalContext != null) {
|
|
763
763
|
if (modalContext.isOpen) {
|
|
764
764
|
onSuccess?.();
|
|
765
765
|
} else if (previousIsOpenRef.current === true) {
|
|
@@ -770,7 +770,7 @@ const HeadlessModal = forwardRef(
|
|
|
770
770
|
}, [modalContext?.isOpen]);
|
|
771
771
|
const [rendered, setRendered] = useState(false);
|
|
772
772
|
useEffect(() => {
|
|
773
|
-
if (rendered && modalContext
|
|
773
|
+
if (rendered && modalContext != null && modalContext.isOpen) {
|
|
774
774
|
if (modalContext.onTopOfStack) {
|
|
775
775
|
onFocus?.();
|
|
776
776
|
} else {
|