Skip to content

fix(auth): prevent guest login prompt triggering on in-page actions - #414

Merged
trtajim merged 1 commit into
mainfrom
fix/guest-login-prompt-navigation
Oct 11, 2026
Merged

trtajim merged 1 commit into
mainfrom
fix/guest-login-prompt-navigation

Conversation

@trtajim

@trtajim trtajim commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Problem

In GuestLoginPrompt.vue, the component listened to Inertia's router.on('navigate') and unconditionally invoked evaluatePrompt(true) on every event. Because Inertia dispatches a navigate event on partial reloads, data refreshes, and form/action interactions on the same page (e.g. closing modals with state reset or in-page actions), guest_browsing_page_count was incremented and the guest login prompt popped up after 1.5 seconds even while staying on the same page.

Solution

  • Added tracking of the current page URL path (lastPath).
  • When Inertia emits navigate, we compare nextPath against lastPath.
  • Only trigger new navigation handling (evaluatePrompt(true)) when the visitor actually navigates to a different page route.
  • Verified asset build (npm run build) succeeds.

Summary by CodeRabbit

  • Bug Fixes
    • Query-string-only changes no longer trigger guest login prompt reevaluation or increase the session page count. Prompt reevaluation still occurs when navigating to a different path.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: hscstack/platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 21d6aa6a-a5be-4539-8862-c25c4651d891

📥 Commits

Reviewing files that changed from the base of the PR and between 35be37f and 5ad57cf.


📒 Files selected for processing (1)
  • resources/js/components/GuestLoginPrompt.vue

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The guest login prompt now records the current pathname on mount. It reevaluates after Inertia navigation only when the destination pathname differs, so query-string-only changes do not trigger reevaluation.

Changes

Guest login prompt navigation tracking

Layer / File(s) Summary
Pathname tracking and navigation filtering
resources/js/components/GuestLoginPrompt.vue
The component stores the current pathname on mount. It compares each destination pathname with the stored pathname and reevaluates the prompt only when they differ.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to 5ad57

Query-only Inertia events no longer trigger the guest prompt, while pathname changes still do. The inspected event contract matches this behavior, and no actionable merge risk remains.

Architecture Summary

Architecture risk: 🔵 Low · up to 5ad57

The change affects 1 system.

Changed systems: resources

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — resources (ui) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in resources/js/components/GuestLoginPrompt.vue: On mount, the component stores the current pathname without its query string. The navigation handler now extracts the destination URL (falling back to page.url) and reevaluates the prompt as a new navigation only when its pathname differs from the stored pathname; previously, every Inertia navigation event triggered reevaluation.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing the guest login prompt from triggering during in-page actions.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@trtajim
trtajim merged commit aca4a0a into main Oct 11, 2026
6 checks passed
@trtajim
trtajim deleted the fix/guest-login-prompt-navigation branch October 11, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant