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

Allow for fetching cached data #23

Open
ncknuna opened this issue Oct 2, 2018 · 3 comments
Open

Allow for fetching cached data #23

ncknuna opened this issue Oct 2, 2018 · 3 comments

Comments

@ncknuna
Copy link

ncknuna commented Oct 2, 2018

Hi! Thanks so much for your work on this package; overall I really like the API!

I was wondering if there's any way to allow for fetching data on mount/update even when that data has been cached? I know that seems to go against the purpose of a cache, but I'd like to optimistically show data that's already been loaded and doesn't change often (and possibly been cached for a longer period of time, like in localStorage/sessionStorage) but still fetch in case any changes have happened. This is for an enterprise application which receives fairly low traffic, so I don't need caching for load reasons.

From my reading of the fetch method, it looks like this isn't something I could do with a custom Cache =/

@techniq
Copy link
Owner

techniq commented Oct 2, 2018 via email

@techniq
Copy link
Owner

techniq commented Oct 2, 2018 via email

@ncknuna
Copy link
Author

ncknuna commented Oct 3, 2018

Unfortunately I need to support IE11, otherwise I would love to use SWs =/

strategy prop sounds like a reasonable approach; would you be okay with me just supporting the existing implementation (via cacheFirst) plus the one I care about (staleWhileRevalidate), with an issue or TODO in the code to add the other strategies as-needed?

I don't think I'll be able to get to this for a little while, but who knows :)

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

No branches or pull requests

2 participants