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

STCOR-832 invalidate react-query cache on login, logout #1504

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Conversation

zburke
Copy link
Member

@zburke zburke commented Jul 16, 2024

Replaces PR #1457, which was just too cumbersome to rebase after all the work that came in STCOR-776 / PR #1463.

Invalidate all react-query caches on login and logout. Because the RQ cache is persistent across sessions, it was possible that empty values were cached if a query returns 4xx when a session ended, and then (incorrectly) reused when the session restarted.

Approach

Pass <QueryClient> down from <RootWithIntl> to some of its children so they can clear the cache immediately after login and before logout. The exact locations of this logic in <MainNavigation> and <SessionEventContainer> are certainly debatable, but using existing components instead of embarking on a larger refactor does have merits.

Refs STCOR-832

Replaces PR #1457, which was just too cumbersome to rebase after all the
work that came in STCOR-776 / PR #1463.

Invalidate all react-query caches on login and logout. Because the RQ
cache is persistent across sessions, it was possible that empty values
were cached if a query returns 4xx when a session ended, and then
(incorrectly) reused when the session restarted.

Approach

Pass `<QueryClient>` down from `<RootWithIntl>` to some of its children
so they can clear the cache immediately after login and before logout.
The exact locations of this logic in `<MainNavigation>` and
`<SessionEventContainer>` are certainly debatable, but using existing
components instead of embarking on a larger refactor does have merits.

Refs STCOR-832
@zburke zburke requested review from JohnC-80 and vashjs July 16, 2024 15:46
Copy link

github-actions bot commented Jul 16, 2024

Bigtest Unit Test Results

193 tests  ±0   188 ✅ ±0   6s ⏱️ ±0s
  1 suites ±0     5 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 77bc926. ± Comparison against base commit 33669a3.

This pull request removes 195 and adds 193 tests. Note that renamed tests count towards both.
      equal to check email label in english translation
      equal to check email precautions label in english translation
      equal to sent email precautions label in english translation
Chrome_126_0_0_0_(Linux_x86_64).About viewing the about page ‑ About viewing the about page has one installed app
Chrome_126_0_0_0_(Linux_x86_64).AppIcon Passing a string to the tag-prop ‑ AppIcon Passing a string to the tag-prop Should render an AppIcon with a HTML tag of "div"
Chrome_126_0_0_0_(Linux_x86_64).AppIcon Passing a string using the children-prop ‑ AppIcon Passing a string using the children-prop Should render an AppIcon with a label
Chrome_126_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using Stripes-context ‑ AppIcon Rendering an AppIcon using Stripes-context Should render an <img>
Chrome_126_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using Stripes-context ‑ AppIcon Rendering an AppIcon using Stripes-context Should render an img with an alt-attribute
Chrome_126_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using an icon-object ‑ AppIcon Rendering an AppIcon using an icon-object Should render an <img>
Chrome_126_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using an icon-object ‑ AppIcon Rendering an AppIcon using an icon-object Should render an img with an alt-attribute
…
Chrome_127_0_0_0_(Linux_x86_64).About viewing the about page ‑ About viewing the about page has one installed app
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Passing a string to the tag-prop ‑ AppIcon Passing a string to the tag-prop Should render an AppIcon with a HTML tag of "div"
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Passing a string using the children-prop ‑ AppIcon Passing a string using the children-prop Should render an AppIcon with a label
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using Stripes-context ‑ AppIcon Rendering an AppIcon using Stripes-context Should render an <img>
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using Stripes-context ‑ AppIcon Rendering an AppIcon using Stripes-context Should render an img with an alt-attribute
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using an icon-object ‑ AppIcon Rendering an AppIcon using an icon-object Should render an <img>
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using an icon-object ‑ AppIcon Rendering an AppIcon using an icon-object Should render an img with an alt-attribute
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Rendering an AppIcon using an icon-object ‑ AppIcon Rendering an AppIcon using an icon-object Should render with a className of "My className"
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Size tests Passing a size of "large" ‑ AppIcon Size tests Passing a size of "large" Should render an icon into a large-sized container
Chrome_127_0_0_0_(Linux_x86_64).AppIcon Size tests Passing a size of "medium" ‑ AppIcon Size tests Passing a size of "medium" Should render an icon into a medium-sized container
…
This pull request removes 5 skipped tests and adds 5 skipped tests. Note that renamed tests count towards both.
Chrome_126_0_0_0_(Linux_x86_64).PasswordValidationField with an invalid password ‑ PasswordValidationField with an invalid password shows a validation error
Chrome_126_0_0_0_(Linux_x86_64).useCustomFields hook requests for existing custom fields ‑ useCustomFields hook requests for existing custom fields should have custom fields
Chrome_126_0_0_0_(Linux_x86_64).useCustomFields hook requests for non-existing custom fields ‑ useCustomFields hook requests for non-existing custom fields should have error
Chrome_126_0_0_0_(Linux_x86_64).useCustomFields hook requests for version-compatible custom fields ‑ useCustomFields hook requests for version-compatible custom fields should have custom fields
Chrome_126_0_0_0_(Linux_x86_64).useCustomFields hook requests for version-incompatible custom fields ‑ useCustomFields hook requests for version-incompatible custom fields should have error
Chrome_127_0_0_0_(Linux_x86_64).PasswordValidationField with an invalid password ‑ PasswordValidationField with an invalid password shows a validation error
Chrome_127_0_0_0_(Linux_x86_64).useCustomFields hook requests for existing custom fields ‑ useCustomFields hook requests for existing custom fields should have custom fields
Chrome_127_0_0_0_(Linux_x86_64).useCustomFields hook requests for non-existing custom fields ‑ useCustomFields hook requests for non-existing custom fields should have error
Chrome_127_0_0_0_(Linux_x86_64).useCustomFields hook requests for version-compatible custom fields ‑ useCustomFields hook requests for version-compatible custom fields should have custom fields
Chrome_127_0_0_0_(Linux_x86_64).useCustomFields hook requests for version-incompatible custom fields ‑ useCustomFields hook requests for version-incompatible custom fields should have error

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 16, 2024

Jest Unit Test Results

  1 files  ±0   39 suites  ±0   50s ⏱️ -1s
291 tests ±0  291 ✅ ±0  0 💤 ±0  0 ❌ ±0 
292 runs  ±0  292 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 77bc926. ± Comparison against base commit 33669a3.

♻️ This comment has been updated with latest results.

Copy link
Member

@ryandberger ryandberger left a comment

Choose a reason for hiding this comment

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

🧹 😄

Copy link

sonarqubecloud bot commented Aug 5, 2024

@JohnC-80 JohnC-80 merged commit f7590a2 into master Aug 5, 2024
26 checks passed
@JohnC-80 JohnC-80 deleted the STCOR-832b branch August 5, 2024 19:41
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.

3 participants