-
Notifications
You must be signed in to change notification settings - Fork 8
✨ Add Offline Mode #694
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
base: main
Are you sure you want to change the base?
✨ Add Offline Mode #694
Conversation
doobry-systemli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice, thanks for tackling this! I made some comments, mostly nitpicking.
src/components/OfflineWarning.tsx
Outdated
| d="M18.364 5.636a9 9 0 010 12.728M5.636 5.636a9 9 0 000 12.728M12 12h.01M8.464 8.464a5 5 0 017.072 7.072M8.464 15.536a5 5 0 010-7.072" | ||
| /> | ||
| </svg> | ||
| <p>You appear to be offline. Some content may be outdated.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking, but this could be shortened: "Offline, content may be outdated."
4700625 to
1a80442
Compare
doobry-systemli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some local testing and it seems to work well.
- The offline indicator message shows immediately when going offline and hides when going back online.
- After opening the ticker once in the browser, I can close the browser and open it again while being offline and the ticker page loads from cache.
- When scrolling to the bottom and then going back online, additional messages load immediately.
- When new messages are added to the ticker while the browser is offline, they load immediately after going back online.
|


This pull request adds offline support and persistent caching to the application, improving the user experience when the network is unavailable. It introduces a service worker for asset and API caching, uses React Query's persistence features to store data in localStorage, and provides a user-visible offline warning. Additionally, it updates the application's logic to better detect and handle offline states.
How to test?
npm run buildnpm run preview