Repository navigation
Fix/746 graceful offline handling - #748
Merged
evilguy4000 merged 3 commits intoSep 4, 2026
Merged
Conversation
added 3 commits
September 3, 2026 15:15
Closes DRYTRIX#746. When the backend became unavailable while a page stayed open, the service worker returned a plain-text 'Offline' response for /api/* GETs, causing JSON parse errors, the chat widget polling loop spammed failed requests every 30s, and identical error toasts stacked up and evicted the ones carrying Retry/Refresh buttons. - sw.js: synthetic offline API responses are now JSON ({"error": "Offline"}) with application/json content-type - chat widget: check response.ok before parsing, back off polling to 2 minutes after a failure, skip polls while the tab is hidden - error handler: dedupe repeated error-with-retry toasts within the dedup window so the toast with Retry/Refresh buttons stays visible - error handler: remove the offline indicator bar when connectivity is restored (previously it stayed until a full page reload)
…bile-client-v2 Cherry-pick of 0e85eae (web/backend/desktop/extension parts only — mobile client excluded). When a timer's idle grace expires with the tab closed, the entry is flagged for review; adds review banner, push/SW handling, scheduled-task detection, migration 183, admin settings toggle, and API/test coverage. Also includes the onboarding skip-tour fix (double-init guard, z-index layering for the skip confirmation, _skipPending tooltip guard).
… tour fix, idle needs-review flow
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.
Description
This PR fixes the open issue #746 — "Service temporarily unavailable" error when the dashboard is left open: when the backend went down while a page stayed open (e.g. over lunch), the browser tab was left with a wall of
SyntaxError: Failed to execute 'json'... "Offline" is not valid JSONmessages, a loop of failing/api/chat/channelspolls every 30 seconds, and stacked "Service temporarily unavailable" error cards whose Retry/Refresh buttons were unreachable.Root cause: the service worker answers failing same-origin
/api/*GETs with a synthetic plain-textResponse('Offline', {status: 503}), which page code then tries to parse as JSON; each polling cycle produced a new identical error toast (max 4 kept), evicting the ones carrying recovery buttons; and the offline indicator bar was never removed on recovery.Changes:
app/static/js/sw.js— synthetic offline API responses are now JSON ({"error":"Offline"}) withapplication/json, so.json()parsing no longer throws on top of the connectivity failure.app/templates/components/persistent_chat_widget.html— channel/message loaders checkresponse.okbefore parsing; polling backs off to 2 minutes after a failure and skips while the tab is hidden.app/static/error-handling-enhanced.js— repeated error-with-retry toasts are deduplicated (60 s window) so the toast with Retry/Refresh stays visible; the offline indicator is removed when connectivity is restored instead of lingering until a page reload.The PR also carries two fixes ported from
mobile-client-v2that were never merged tomain:183_add_idle_needs_review, desktop + browser-extension reporting).!importantz-index layering, and a pending-skip guard so the "Are you sure you want to skip the tour?" confirmation stays readable and clickable.Type of change
Checklist
tests/test_api_v1.pyextended for the needs-review endpoints)pytest tests/test_api_v1.py: 40 passed; changed JS verified withnode --check, Jinja templates parse-checked, JS bundles rebuilt.CHANGELOG.md)Related issues
Fixes #746
Deploy note: run
flask db upgradeafter merge (migration183_add_idle_needs_review).