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

fix(admin): reset all redux toolkit cache on logout #20318

Merged
merged 5 commits into from
May 20, 2024

Conversation

joshuaellis
Copy link
Member

@joshuaellis joshuaellis commented May 16, 2024

What does it do?

  • refactors the admin to only use one createApi function for the entire app (plugins can use this too) so we can call resetApiState once on log out to clear the whole redux cache. When we migrate the rest of the app to use redux/toolkit it'll "just work"
  • refactored some exports from the admin to satisfy typescript and tidy up the fetch work

Why is it needed?

  • If someone logs out we might not necessarily refetch data if all the params we pass to hooks match. This ensures that things are wiped clean.

Related issue(s)/PR(s)

  • resolves DX-1416

@joshuaellis joshuaellis added source: core:admin Source is core/admin package pr: fix This PR is fixing a bug labels May 16, 2024
@joshuaellis joshuaellis self-assigned this May 16, 2024
Copy link

vercel bot commented May 16, 2024

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

Name Status Preview Comments Updated (UTC)
contributor-docs 🛑 Canceled (Inspect) May 20, 2024 1:16pm

Copy link
Member

@Bassel17 Bassel17 left a comment

Choose a reason for hiding this comment

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

Great job, thanks for tiding things up,
I left a few suggestions/comments, otherwise all looks good

packages/core/admin/admin/src/services/api.ts Outdated Show resolved Hide resolved
packages/core/admin/admin/src/services/api.ts Outdated Show resolved Hide resolved
joshuaellis and others added 2 commits May 20, 2024 14:13
Co-authored-by: Bassel Kanso <basselkanso82@gmail.com>
Copy link
Member

@Bassel17 Bassel17 left a comment

Choose a reason for hiding this comment

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

looks great

@joshuaellis joshuaellis merged commit e98c3e2 into v5/main May 20, 2024
24 of 29 checks passed
@joshuaellis joshuaellis deleted the fix/reset-cache-on-logout branch May 20, 2024 13:43
@echoes-hq echoes-hq bot added echoes/type: maintenance Upkeeping efforts, chores and catch-up corrective improvements that are not features nor bugs echoes/type: maintenance/refactor For work refactoring tech debt or legacy work labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes/type: maintenance/refactor For work refactoring tech debt or legacy work echoes/type: maintenance Upkeeping efforts, chores and catch-up corrective improvements that are not features nor bugs pr: fix This PR is fixing a bug source: core:admin Source is core/admin package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants