From 5ad57cf2e394c7788d73634cdbedda7a6a3eac2f Mon Sep 17 00:00:00 2001 From: TR Tajim Date: Sun, 11 Oct 2026 12:12:17 +0600 Subject: [PATCH] fix(auth): prevent guest login prompt triggering on in-page actions --- resources/js/components/GuestLoginPrompt.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/resources/js/components/GuestLoginPrompt.vue b/resources/js/components/GuestLoginPrompt.vue index 4b3f53b1..46534fe7 100644 --- a/resources/js/components/GuestLoginPrompt.vue +++ b/resources/js/components/GuestLoginPrompt.vue @@ -119,12 +119,21 @@ const evaluatePrompt = (isNewNavigation = false) => { } }; +let lastPath = ''; + onMounted(() => { + lastPath = page.url.split('?')[0]; evaluatePrompt(false); // Reliably catch all client-side Inertia page navigations - unregisterNavigate = router.on('navigate', () => { - evaluatePrompt(true); + unregisterNavigate = router.on('navigate', (event) => { + const nextUrl = event.detail?.page?.url || page.url; + const nextPath = nextUrl.split('?')[0]; + + if (nextPath !== lastPath) { + lastPath = nextPath; + evaluatePrompt(true); + } }); });