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

implement optional stale-while-revalidate behavior #3

Open
clockelliptic opened this issue Jan 1, 2024 · 0 comments
Open

implement optional stale-while-revalidate behavior #3

clockelliptic opened this issue Jan 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@clockelliptic
Copy link
Owner

clockelliptic commented Jan 1, 2024

To Do: implement optional stale-while-revalidate behavior

Why:

  • support & maximize progressive behavior
  • allow stale or placeholder data to be shown optimistically while new data is loaded in the background, ideally in a non-blocking fashion

Acceptance Criteria:

  • IDBSideloader constructor accepts an optional prop to enable stale-while-revalidate (swr) behavior
  • swr behavior attempt to load cached data, and then re-fetches data in the background
  • swr option is compatible with web worker option

example: IDBSideloader constructor prop

const loader = new IDBSideloader({ swr: true });

example: per-asset basis

<!-- attempts to show cached image data while re-validating/re-fetching -->
<img
  data-swr="true"
  data-src="user-statistics-chart.webp"
/>

Optional:

see: https://www.mnot.net/blog/2007/12/12/stale

@clockelliptic clockelliptic added the enhancement New feature or request label Jan 6, 2024
@clockelliptic clockelliptic changed the title todo: implement optional stale-while-revalidate behavior implement optional stale-while-revalidate behavior Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant