fix(logout): purge the namespaced Cache API store on logout#41303
fix(logout): purge the namespaced Cache API store on logout#41303rusackas wants to merge 1 commit into
Conversation
GET responses with an ETag were persisted into the @SUPERSET-UI/CONNECTION Cache API namespace and retained across sessions, with no purge on logout. The logout handler already cleared the persisted redux localStorage and session storage; extend it to also delete the namespaced Cache API store so cached responses are not retained on the device after the session ends. Best-effort (the promise is not awaited since logout navigates away). Extends the existing RightMenu logout test to assert the cache namespace is purged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Code Review Agent Run #8ceda9Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41303 +/- ##
=======================================
Coverage 64.34% 64.34%
=======================================
Files 2653 2653
Lines 144952 144954 +2
Branches 33433 33434 +1
=======================================
+ Hits 93273 93275 +2
Misses 49995 49995
Partials 1684 1684
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SUMMARY
GET responses carrying an
ETagwere persisted into the@SUPERSET-UI/CONNECTIONCache API namespace and retained across sessions, with no purge on logout.The logout handler in
RightMenualready cleared the persisted reduxlocalStorage(which holds SQL Lab editor/results state) and session storage. This extends it to also delete the namespaced Cache API store, so cached GET responses are not retained on the device after the session ends. The deletion is best-effort (the promise is not awaited, since logout immediately navigates away) and uses the exportedCACHE_KEYconstant.This completes the on-logout client-state clearing:
localStorage['redux'](already cleared), session storage (already cleared), and now the Cache API namespace.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — client-side cleanup behavior.
TESTING INSTRUCTIONS
The existing
RightMenulogout test is extended to mock the Cache API and assertcaches.delete('@SUPERSET-UI/CONNECTION')is called on logout (alongside the existing localStorage/sessionStorage assertions).Run:
cd superset-frontend && npm run test -- src/features/home/RightMenu.test.tsxADDITIONAL INFORMATION