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

Offline caching: Try To fetch latest data first then shift to cached one. #1819

Merged
merged 3 commits into from
Feb 27, 2021

Conversation

vivek-30
Copy link

Fixes #1237.
finally there is no such problem of having cached data every time . Service worker will now look for latest data first and then shift to cached one if request became unsuccessful.

@vivek-30 vivek-30 requested a review from a team as a code owner February 20, 2021 14:56
@gitpod-io
Copy link

gitpod-io bot commented Feb 20, 2021

@vivek-30
Copy link
Author

@jywarren , @harshkhandeparkar could you please review this ☺️

@harshkhandeparkar
Copy link
Member

Sorry but my knowledge about service workers is just shy of -1 😂

@vivek-30
Copy link
Author

Sorry but my knowledge about service workers is just shy of -1 😂

No problem @harshkhandeparkar 😊. you have a wide spectrum of knowledge though😅.

@jywarren
Copy link
Member

Ah, interesting. Is this something we can write a test for as well?

Is there a loading indicator shown while trying to fetch? I'm imagining a slow internet connection, or a 502 error, and if there'd be an option to bypass the wait and use the cache?

Thank you @vivek-30 this is cool!

@vivek-30
Copy link
Author

@jywarren i will add a loading animation for this and taking about the test . i have already created it when i solved another problem related to service worker
for this problem i have modified some code accordingly

@vivek-30
Copy link
Author

hope you remember. btw great to see you after 3 days 😊

@vivek-30
Copy link
Author

trying to bypass the wait is something which i feel is a little impractical. may be as the rendering time will be so quick even in slow connection and switching in the timeframe may lead to some unavoidable issues

@vivek-30
Copy link
Author

still i will see what cool stuff i can generate meanwhile thanks☺️

@vivek-30
Copy link
Author

@jywarren Did all the requested changes -

Screen.Recording.2021-02-25.at.1.34.51.PM.mov

Also the loading animation is already present in the sequencer 😅 ,and thing which you want will require some ajax requests but as this is a single page application that kind of loading will not be required at all
but now there will be a good offline experience for a user.it will be pre-cached auto. while installing a new service worker.

@vivek-30
Copy link
Author

hope you like this 😊

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nicely done. Thank you so much!!!

@jywarren jywarren merged commit 71bf8c8 into publiclab:main Feb 27, 2021
@vivek-30 vivek-30 deleted the service-worker branch February 28, 2021 08:22
@jywarren jywarren changed the title Try To fetch latest data first then shift to cached one. Offline caching: Try To fetch latest data first then shift to cached one. Mar 25, 2021
@harshkhandeparkar harshkhandeparkar added this to In Progress in v3.7.0 via automation Jul 27, 2021
@jywarren jywarren moved this from In Progress to Done in v3.7.0 Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
v3.7.0
  
Done
Development

Successfully merging this pull request may close these issues.

service worker responds with cache to fetch requests everytime its available
3 participants