Repository navigation
fix: [Portal] If you sign out of the portal while logged in and using an application that requires authentication, the system will trigger three "Access Denied" error messages. #7804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the review of the code changes:
1. Potential Issue: Stale Closure of
routeProblem: The
handleLogoutfunction usesrouter.replace. Inside the callback, it accessesroute.metaandroute.params.If this is a Vue component where
routecomes fromuseRoute(),routeis a reactive object. However, in a.then()promise callback, if the user navigates away before the logout API resolves, or if the component unmounts, relying on the current reactiveroutestate might be unreliable depending on how Vue handles reactivity during async callbacks.More importantly, using
routeinside the async callback risks capturing the wrong context if the logic isn't carefully bound. While Vue'sref/reactiveobjects generally persist their properties even after navigation events trigger updates, it is clearer and safer to capture the necessary parts (portalstatus,accessToken) before the promise chain or ensure they are accessed reliably.However, the bigger issue is UX and Logic:
route.params.accessTokenmight no longer be valid or relevant for the new anonymous session ifchat-homeexpects an active access token. Passing a stale/invalidaccessTokenas a param could cause immediate errors upon navigation if the next page guards or composables try to use it immediately.2. Irregularity: Silent Error Handling
The
.catch(() => {})silently swallows all errors, including network failures fromauth.logout()or router errors. This makes debugging extremely difficult.Suggestion: At minimum, log the error, or show a toast notification if logout failed (though usually, local cleanup should happen regardless).
3. Optimization/Best Practice: Explicit vs. Implicit Navigation
Using
route.name === 'portal-application-list'checksroute.meta.portal. This couples routing logic with view metadata. It is generally fine but ensuremeta.portalis strictly typed and always present when expected.4. Code Style & Readability
router.replace()is visually cluttered. Extracting the target route into a variable improves readability.force: trueis passed in both branches. Ensure this is actually needed. Forcing a replace might reset scroll positions unnecessarily if the content is similar, but usually good for login/logout.✅ Recommended Improved Version
Key Recommendations:
chat-homereally needsaccessTokenparam after logout. Usually, post-logout routes are public or require new auth initiation, not old tokens.if/elsebefore callingrouter.replacefor cleaner code.