Skip to content
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

Cloud UI: Fix 401 error on the Project page due to stale JWT #5080

Merged
merged 8 commits into from
Jun 17, 2024

Conversation

ericpgreen2
Copy link
Contributor

@ericpgreen2 ericpgreen2 commented Jun 15, 2024

Currently, re-visiting a Project page can trigger a 401 error. In the error case, a stale JWT sits in the GetProject Query Cache and is used in a runtime request. The 401 triggers a full-screen error page.

This PR does a few things to mitigate this, notably:

  1. Adds refetchOnMount, refetchOnWindowFocus, and refetchOnReconnect to refetch the JWT when the user re-visits the page
  2. Explicitly adds cacheTime to garbage-collect old JWTs
  3. Removes the full-screen error page for runtime 401s on the Project page

Bug report in Slack

@ericpgreen2 ericpgreen2 self-assigned this Jun 15, 2024
Copy link
Collaborator

@AdityaHegde AdityaHegde left a comment

Choose a reason for hiding this comment

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

Just left one comment. Looks good otherwise

web-admin/src/features/errors/error-utils.ts Show resolved Hide resolved
@ericpgreen2 ericpgreen2 merged commit 4f516f0 into main Jun 17, 2024
4 checks passed
@ericpgreen2 ericpgreen2 deleted the fix-stale-jwt branch June 17, 2024 16:52
ericpgreen2 added a commit that referenced this pull request Jun 17, 2024
* Make sure to refetch stale JWTs

* Make sure we don't keep a stale JWT in the cache

* Don't show a full-screen error page for runtime 401s on the project page

* Destructure store to avoid remounting Query Observer on navigation

* Use correct query key for runtime information

* Fix breadcrumb flicker

* Only increment `receivedAt` if the JWT has actually changed

* Backwards-compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants