fix: logout button not working in profile dropdown#421
Merged
Conversation
The logout action relied on a native form submit (`<form @submit.prevent>`) inside reka-ui's NavigationMenuLink. Clicking the submit button dispatches NavigationMenuLink's rootContentDismiss, which closes the menu. Vue flushes that DOM update in the microtask checkpoint that runs immediately after the click listener returns, unmounting the form before the browser performs the submit button's default action. As a result the form's submit event never fired and logout never happened. Trigger logout from a synchronous @click on the dropdown link instead, so the emit runs during click dispatch (before the menu unmounts) rather than depending on the form-submit default action. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vt4JQch9DkZubZT1ypJoDe
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
PR Summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The logout button in the desktop profile dropdown did nothing when clicked.
Root cause
In
ProfileDropdown.vue, logout relied on a native form submit:This form lives inside reka-ui's
NavigationMenuLink. When the submit button is clicked,NavigationMenuLink's click handler synchronously dispatches itsrootContentDismissevent, which closes the dropdown. Vue flushes that DOM update in the microtask checkpoint that runs immediately after the click listener returns — unmounting the form before the browser performs the submit button's default action. So the form'ssubmitevent never fires,emit('logout')is never called, and the user is never logged out.The mobile/responsive logout uses a plain form inside a
Sheet(not aNavigationMenuLink), which is why it kept working — consistent with the reported symptom.Fix
Trigger logout from a synchronous
@clickon the dropdown link instead of depending on the form-submit default action. The@clickruns during click dispatch — before the menu unmounts — soemit('logout')reachesMainNavbarCustom'srouter.post(route('logout'))reliably.The event chain (
ProfileDropdown→NavDynamicItem→MainNavbarCustom) is unchanged.Testing notes
This is a client-side event-timing bug. The repo has no JS test harness (no Vitest/Jest) and the existing Pest feature tests can't reproduce a browser microtask-ordering issue, so no automated test was added. Verified by tracing the event flow against the bundled reka-ui
NavigationMenuLinkclick handler.