Skip to content

fix(pwa): restore service worker auto-update and bump to v1.2.2#79

Merged
wsxiaolin merged 1 commit into
mainfrom
codex/fix-issues-in-auto-update-functionality
May 24, 2026
Merged

fix(pwa): restore service worker auto-update and bump to v1.2.2#79
wsxiaolin merged 1 commit into
mainfrom
codex/fix-issues-in-auto-update-functionality

Conversation

@wsxiaolin
Copy link
Copy Markdown
Member

Motivation

  • The service worker was not taking control after installation because lifecycle calls were missing, causing updates to be downloaded but not activated.
  • The application entry did not register the runtime update handler, so the front-end never triggered update checks and activation.
  • Importing virtual:pwa-register caused a TypeScript resolution error without the plugin's client types.
  • The app version needed to be bumped to reflect the release with these PWA fixes.

Description

  • Added self.skipWaiting() and clientsClaim() to src/sw.ts so a newly installed SW activates and takes control immediately.
  • Imported and invoked registerSW({ immediate: true }) from virtual:pwa-register in src/main.ts to enable runtime update registration.
  • Added src/types/pwa-register.d.ts with /// <reference types="vite-plugin-pwa/client" /> to provide the necessary TypeScript typings for virtual:pwa-register.
  • Bumped version from 1.2.1 to 1.2.2 in package.json and package-lock.json.

Testing

  • Ran npm run build, which initially failed due to a missing module type, and then succeeded after adding the type declaration.
  • The final vite build completed successfully and the PWA injectManifest step produced the service worker (dist/sw.js).
  • No other automated tests were added or modified; the production build artifacts were verified by the successful build run.

Codex Task

@wsxiaolin
Copy link
Copy Markdown
Member Author

@codex

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wsxiaolin wsxiaolin merged commit 41fb5ac into main May 24, 2026
5 checks passed
@wsxiaolin wsxiaolin deleted the codex/fix-issues-in-auto-update-functionality branch May 24, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant