Skip to content

Comments

fix: clear sessionStorage in fetchAll to ensure data freshness#316

Open
ArtemZhyto wants to merge 1 commit intochicagopcdc:masterfrom
ArtemZhyto:fix/session-cache-invalidation
Open

fix: clear sessionStorage in fetchAll to ensure data freshness#316
ArtemZhyto wants to merge 1 commit intochicagopcdc:masterfrom
ArtemZhyto:fix/session-cache-invalidation

Conversation

@ArtemZhyto
Copy link

Description

This PR resolves issue #295 by ensuring that sessionStorage is cleared whenever a full data re-fetch is triggered.

Changes

  • Manual Cache Invalidation: Added sessionStorage.removeItem() calls for studies, eligibility-criteria, and match-conditions inside the fetchAll function.
  • Reliable Updates: This fix ensures that clicking "Try Again" or re-logging actually fetches fresh data from the server instead of returning stale cached objects from the browser session.

Why this is necessary

Currently, the API hooks check sessionStorage and return cached data indefinitely if present. By clearing these keys at the start of fetchAll, we force the application to perform actual network requests and update the UI with the latest information from the backend.

Note on Implementation

The key gearbox:eligiblity-criteria intentionally includes the existing typo to ensure it correctly targets the current storage key used in the codebase.

Fixes #295

@GziXnine
Copy link

Hi @ArtemZhyto

I just wanted to clarify something regarding this issue.

I had previously reported and worked on this issue, and I also referenced it in my proposal. I believe there might have been a misunderstanding since the issue reference didn’t get properly linked in my earlier PR.

Sorry for any confusion caused.

You can check my earlier mention on the issue thread for reference.

Wishing you the best of luck with your contributions, and I truly hope you achieve great milestones in GSoC.

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.

Session cache (sessionStorage) has no invalidation — stale clinical trial data persists after backend updates

2 participants