Skip to content

Fix(logout) : Logout not working when deployed #482

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

Merged
merged 1 commit into from
May 31, 2024

Conversation

ntatoud
Copy link
Member

@ntatoud ntatoud commented May 30, 2024

Describe your changes

closes #481
Make the logout mutation async so that it can be awaited properly

Question : Is there still a point to making the optimistic update ?

The code before : (await has no effect)
image

This lead to :
Redirection happening before the logout and triggering checkAuthenticated before the end of logout.
Reminder : checkAuthenticated sets a new auth cookie.

What happend before on the logout page :

  1. Call logout
  2. Redirection
  3. Call checkAuthenticated (user still in context)
  4. Suppression of the cookie
  5. Cookie set again in checkAuthenticated
  6. User not logged out

image

After the fix:
image

Checklist

  • I performed a self review of my code
  • I ensured that everything is written in English
  • I tested the feature or fix on my local environment

Copy link

vercel bot commented May 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
start-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2024 4:10pm

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@ivan-dalmet ivan-dalmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.
Yes I think we still need the code to update the check value because else the value "true" will still be in the cache. We could do an invalidate query but we know the value.

@ntatoud ntatoud merged commit 546abf6 into master May 31, 2024
7 checks passed
@ntatoud ntatoud deleted the fix/logout-not-working branch May 31, 2024 07:20
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.

Auth cookie not always deleted on logout
2 participants