Skip to content

fix(pwa): re-enable Workbox precaching (remove injectionPoint override)#611

Draft
Just-Insane wants to merge 3 commits intoSableClient:devfrom
Just-Insane:fix/workbox-precaching
Draft

fix(pwa): re-enable Workbox precaching (remove injectionPoint override)#611
Just-Insane wants to merge 3 commits intoSableClient:devfrom
Just-Insane:fix/workbox-precaching

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

Related to closed PR #548 (fix/media-error-handling), which was split into smaller focused PRs.

Description

injectionPoint: undefined was set in vite.config.ts to silence a Workbox AssertionError about multiple self.__WB_MANIFEST occurrences (an if guard in sw.ts plus the precacheAndRoute() call = two matches; Workbox requires exactly one). The unintended consequence: Workbox never injected the precache manifest, so no assets were precached — every cold start hit the network instead of serving from cache, and offline use was broken entirely.

Fix: remove the if guard in sw.ts (leaving exactly one self.__WB_MANIFEST reference) then remove injectionPoint: undefined from vite.config.ts to restore normal precaching behaviour.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

The root cause diagnosis (two self.__WB_MANIFEST references causing Workbox to silently skip injection) was identified with AI assistance. I verified the fix by checking Workbox's injectionPoint behaviour and confirming precaching was restored.

Removes injectionPoint: undefined which silently disabled ALL precaching —
self.__WB_MANIFEST was never injected so precacheAndRoute was a no-op and
every cold start hit the network. Also excludes element-call assets from
the precache manifest and raises the per-file size limit to 10 MiB for the
app's own WASM and main bundle.
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners March 31, 2026 18:43
@Just-Insane Just-Insane marked this pull request as draft March 31, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant