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

Make PWA work offline #863

Open
EricPedley opened this issue Jan 17, 2024 · 3 comments
Open

Make PWA work offline #863

EricPedley opened this issue Jan 17, 2024 · 3 comments
Assignees
Labels
enhancement Improvements to the user experience medium Medium priority issue

Comments

@EricPedley
Copy link
Member

EricPedley commented Jan 17, 2024

RN we can download AntAlmanac as a PWA but it doesn't work offline. We can probably fix this by caching all the requests for the schedule and course info (don't quote me on this though, idk if this is the exact solution we need).

Timeline

  • Have static data cached and successfully load by 31 October.
  • Finish MVP with offline schedule by 7 November.
@EricPedley EricPedley added enhancement Improvements to the user experience medium Medium priority issue labels Jan 17, 2024
@teresa-liang teresa-liang self-assigned this Jan 19, 2024
@MinhxNguyen7
Copy link
Member

@teresa-liang how's this looking? If you've started coding, can you put up a PR?

@MinhxNguyen7
Copy link
Member

@adcockdalton Can you put up some information about what the difficulties are so that we might help you/decide that it's not worth the trouble? @ap0nia to Vite + Turbo, I think, so he might be able to help.

@adcockdalton
Copy link
Collaborator

Of course,

so frameworks like Create-React-App have their own handlers (namely Workbox) for service workers, which are created behind-the-scenes with default functionality. This just caches the assets, however, unless you modify it. However, I was not even getting that functionality, so I assumed that functionality was lost with the migration to Vite (which I was only partially aware of--my fault on that).

But when I added a service worker manually and attempted to load a test component via the cache, I was able to get console to print "service worker registered" without errors but I got no functionality.

Which brings me to Vite, since it seems to have a plugin for PWA, meaning perhaps you have to use their package? However, I think we should still be able to add a service worker normally, so I'm not sure.
https://vite-pwa-org.netlify.app/guide/register-service-worker

Once the service worker is confirmed to work for at least the assets, the task is writing logic to cache the data and refresh it when certain conditions are met (and provide layers of fallback). Assuming no technological hiccups, this should just be a series of relatively easy design choices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to the user experience medium Medium priority issue
Projects
Status: In Progress 🤠
Development

No branches or pull requests

4 participants