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

SWR behavior #42

Open
wong2 opened this issue Nov 11, 2022 · 2 comments
Open

SWR behavior #42

wong2 opened this issue Nov 11, 2022 · 2 comments

Comments

@wong2
Copy link

wong2 commented Nov 11, 2022

🚀 Feature Proposal

Implement SWR behavior, that the cached data is returned while new data are fetched in the background.

Motivation

This can help prevent the splash blank page while the translation data are loading.

@adrai
Copy link
Member

adrai commented Nov 11, 2022

Feel free to try a PR

@jamuhl
Copy link
Member

jamuhl commented Nov 11, 2022

Only worth on very slow networks IMO. Not something that this backend can solve.

You might have to create a new backend like https://github.com/i18next/i18next-chained-backend that does all the magic:

  • take from localstorage and return that if found
  • load from http-backend and retrigger rendering (event on i18next? reloaded? loaded?)
  • cache the newly loaded JSON if newer than current data

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

3 participants