feat(offline): impl client chat store, service worker, UX #2377
Open
LoneRifle wants to merge 2 commits into
Open
feat(offline): impl client chat store, service worker, UX #2377LoneRifle wants to merge 2 commits into
LoneRifle wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a4e58b0bc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Collaborator
|
that's a lot of changes I'll try to take a look when I've time but can't guarantee it will be soon |
a9f2aed to
ccbf82d
Compare
ccbf82d to
3b98f22
Compare
de8d2e3 to
97685d4
Compare
Implements offline-mode support, with service worker, connectivity store, and comprehensive UX guards. **1. Service Worker (`src/service-worker.ts`)** - Precaches app shell using SvelteKit's `$service-worker` module - Runtime caching for attachment blobs (GET `/output/[sha256]` - cache-first) - Cache-first for assets, Network-first for API calls - `message` listener for `SKIP_WAITING` support - Old cache cleanup on activation **2. Connectivity Store (`src/lib/stores/isOnline.svelte.ts`)** - Svelte 5 runes store tracking `navigator.onLine` - Listens to `online`/`offline` events **3. Frontend Update Handling (`src/routes/+layout.svelte`)** - New SW waiting detection with "Update Now" notification bar - Posts `SKIP_WAITING` to activate new version - Listens for `controllerchange` to reload **4. Offline UX Enhancements** - Offline banner in layout - ChatInput disabled (textarea, uploads, MCP) with tooltips - Voice recording and send button disabled in ChatWindow - NavMenu "New Chat" visually disabled - NavConversationItem Rename/Delete disabled - UploadedFile triggers fetch for SW caching
97685d4 to
59b070f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces robust offline support to the chat UI by implementing a new IndexedDB-backed caching layer for conversations and a reliable online/offline detection mechanism. The UI is now aware of connectivity status, disabling actions that require a network connection and providing clear feedback to users. The most significant changes are grouped below.
Offline detection and UI adaptation:
Introduced a new
isOnlinestore (useIsOnline) that reliably detects real connectivity by probing a healthcheck endpoint, improving on the limitations ofnavigator.onLine. UI components now reactively use this store to enable or disable actions depending on online status, and provide tooltips explaining why actions are unavailable when offline.Updated UI elements—including chat input, file uploads, attachments, new chat button, conversation rename/delete, and voice recording—to be disabled when offline, with appropriate visual cues and accessibility titles.
Closes #2344