Fix PWA install banner not rendering and service worker cache failures#5499
Open
udithishanka wants to merge 5 commits intojaseci-labs:mainfrom
Open
Fix PWA install banner not rendering and service worker cache failures#5499udithishanka wants to merge 5 commits intojaseci-labs:mainfrom
udithishanka wants to merge 5 commits intojaseci-labs:mainfrom
Conversation
Three bugs in jac-client PWA target: 1. JS comments using // inside Jac string literals get first slash stripped by Jac compiler, producing invalid JS (SyntaxError: Unexpected token ':'). Changed all // to /* */ block comments in generated JS strings. 2. cache.addAll() in service worker fails entirely if any URL returns non-2xx (e.g. auth redirects). Replaced with individual cache.add() + .catch() so partial failures don't break SW installation. 3. render_page() only injected manifest link and SW registration for PWA but missed the beforeinstallprompt capture and install banner scripts. Added imports of _build_install_prompt_capture_script and _build_pwa_install_banner_script to the runtime render path.
478b14a to
4aeb0f5
Compare
The API base URL guard in _format_define_entries is needed for desktop builds where Tauri injects the URL at runtime. Reverted comment style changes (/* */ back to //) as they were unnecessary.
…uard Ensures the three PWA runtime scripts (prompt capture, SW registration, install banner) stay wired into client.impl.jac, and that the API base URL define is skipped for desktop/Tauri builds.
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.
Summary
//comments in Jac string literals being corrupted by compiler (stripped to single/), causingSyntaxErrorin generated PWA scriptscache.addAll()with resilient individualcache.add()+.catch()so auth-redirected URLs don't crash service worker installationbeforeinstallpromptcapture and install banner script injection torender_page()runtime pathChanges
jac-client/jac_client/plugin/src/targets/impl/pwa_target.impl.jac— Changed//to/* */in all generated JS strings; replacedaddAllwith individual caching; removed'./'from precache listjac-client/jac_client/plugin/impl/client.impl.jac— Import and call_build_install_prompt_capture_scriptand_build_pwa_install_banner_scriptin PWA render pathTest plan
jac build --client pwa main.jacand verifysw.jsandindex.htmlhave valid JS (no single-slash comments)jac start --client pwa main.jacand verify install banner appears after 3 secondsaddAllcache errors in console