Skip to content

Commit

Permalink
No interception of visits as we can't grab the events
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Jan 22, 2025
1 parent f7c0bc4 commit 3030a38
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 127 deletions.
64 changes: 0 additions & 64 deletions react/src/ModalRoot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -475,70 +475,6 @@ export const ModalRoot = ({ children }) => {
let isNavigating = false
let previousModalOnBase = false

useEffect(
() =>
router.on('before', ($event) => {
if (!sameUrlPath(window.location.href, $event.detail.visit.url)) {
// Not navigating to the same base url
return true
}

if ($event.detail.visit.replace) {
// Prevent replacing again if we are already replacing
return true
}

if (context.length() !== 1) {
// Only replace the first modal
return true
}

if (!previousModalOnBase) {
// No modal on base
return true
}

const {
method,
data,
only,
except,
headers,
errorBag,
forceFormData,
queryStringArrayFormat,
async,
showProgress,
prefetch,
fresh,
reset,
preserveUrl,
} = $event.detail.visit

router.visit($event.detail.visit.url, {
replace: true,
preserveScroll: true,
preserveState: true,
method,
data,
only,
except,
headers,
errorBag,
forceFormData,
queryStringArrayFormat,
async,
showProgress,
prefetch,
fresh,
reset,
preserveUrl,
})

return false
}),
[],
)
useEffect(() => router.on('start', () => (isNavigating = true)), [])
useEffect(() => router.on('finish', () => (isNavigating = false)), [])
useEffect(
Expand Down
63 changes: 0 additions & 63 deletions vue/src/ModalRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,6 @@ const modalStack = useModalStack()
const isNavigating = ref(false)
const previousModalOnBase = ref(null)
onUnmounted(
router.on('before', ($event) => {
if (!sameUrlPath(window.location.href, $event.detail.visit.url)) {
// Not navigating to the same base url
return true
}
if ($event.detail.visit.replace) {
// Prevent replacing again if we are already replacing
return true
}
if (modalStack.stack.value.length !== 1) {
// Only replace the first modal
return true
}
if (!usePage().props?._inertiaui_modal) {
// No modal on base
return true
}
const {
method,
data,
only,
except,
headers,
errorBag,
forceFormData,
queryStringArrayFormat,
async,
showProgress,
prefetch,
fresh,
reset,
preserveUrl,
} = $event.detail.visit
router.visit($event.detail.visit.url, {
replace: true,
preserveScroll: true,
preserveState: true,
method,
data,
only,
except,
headers,
errorBag,
forceFormData,
queryStringArrayFormat,
async,
showProgress,
prefetch,
fresh,
reset,
preserveUrl,
})
return false
}),
)
onUnmounted(router.on('start', () => (isNavigating.value = true)))
onUnmounted(router.on('finish', () => (isNavigating.value = false)))
onUnmounted(
Expand Down

0 comments on commit 3030a38

Please sign in to comment.