From 21554b241f731c1923635ab5d5878db354339d45 Mon Sep 17 00:00:00 2001 From: Pascal Baljet Date: Thu, 24 Oct 2024 22:03:16 +0200 Subject: [PATCH] WIP fix for `navigate` option in `visitModal()` See #19 --- react/src/ModalRoot.jsx | 2 ++ vue/src/inertiauiModal.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/react/src/ModalRoot.jsx b/react/src/ModalRoot.jsx index 3a86ba3..a618de6 100644 --- a/react/src/ModalRoot.jsx +++ b/react/src/ModalRoot.jsx @@ -6,6 +6,7 @@ import { mergeDataIntoQueryString } from '@inertiajs/core' import { createContext, useContext } from 'react' import ModalRenderer from './ModalRenderer' import { waitFor } from './helpers' +import { getConfig } from './config' const ModalStackContext = createContext(null) ModalStackContext.displayName = 'ModalStackContext' @@ -269,6 +270,7 @@ export const ModalStackProvider = ({ children }) => { options.onClose, options.onAfterLeave, options.queryStringArrayFormat ?? 'brackets', + options.navigate ?? getConfig('navigate'), ) const visit = ( diff --git a/vue/src/inertiauiModal.js b/vue/src/inertiauiModal.js index ed14b1e..ce5493b 100644 --- a/vue/src/inertiauiModal.js +++ b/vue/src/inertiauiModal.js @@ -5,6 +5,7 @@ import Modal from './Modal.vue' import ModalLink from './ModalLink.vue' import ModalRoot from './ModalRoot.vue' +// TODO: Move this to modalStack.js + Add test for navigate option function visitModal(url, options = {}) { return useModalStack().visit( url, @@ -15,6 +16,7 @@ function visitModal(url, options = {}) { options.onClose, options.onAfterLeave, options.queryStringArrayFormat ?? 'brackets', + options.navigate ?? getConfig('navigate'), ) }