mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
[As mentioned in the issue](https://github.com/coder/coder/issues/12056#issuecomment-3206975879) the problem here is the fact this endpoint is returning a 401 instead of a 200 in this specific case. Since we actually have enough information before performing this mutation to know that it'll fail in the case of a bad auth token we'd ideally re-work the code not to call the mutation on logout and just perform the local clean up. Unfortunately it seems like the interactions that this mutation is having with React Query at large is necessary for our code to work as intended and thus it's not currently possible to move the local clean up (the code inside of the `onSuccess`) outside of the mutation. Shout out to @Parkreiner for helping me confirm this. So until we can re-work the `AuthProvider` to be less brittle this PR changes `onSuccess` to `onSettled` so that while the mutation still fails with a 401, the local clean up still runs. Closes #12056