Skip to content

Refactor update trigger from useEffect to direct event handler#45

Merged
SCdF merged 1 commit intomainfrom
refactor-update-trigger-event-handler
Jan 20, 2026
Merged

Refactor update trigger from useEffect to direct event handler#45
SCdF merged 1 commit intomainfrom
refactor-update-trigger-event-handler

Conversation

@SCdF
Copy link
Owner

@SCdF SCdF commented Jan 20, 2026

Summary

  • Move the service worker update trigger (postMessage SKIP_WAITING) from a reactive useEffect chain to direct calls in click handlers
  • Add registration.ts module to store ServiceWorkerRegistration outside React (same pattern as PouchDB handle)
  • Remove userReadyToUpdate state from Redux slice - no longer needed
  • Minor CLAUDE.md update to clarify yarn test already includes --run

Test plan

  • Verify app builds successfully
  • Test PWA update flow when an update is available
  • Verify "Update now" button in UpdatePanel triggers the update
  • Verify Update menu item in the hamburger menu triggers the update

🤖 Generated with Claude Code

Move the service worker update trigger (postMessage SKIP_WAITING) from a
reactive useEffect chain to a direct call in the click handler. This
eliminates the userReadyToUpdate state and the cascading effect pattern.

- Add registration.ts module to store ServiceWorkerRegistration outside React
- Call triggerUpdate() directly in UpdatePanel and UpdateMenuItem click handlers
- Remove userReadyToUpdate state from updateSlice
- Update CLAUDE.md to clarify yarn test already includes --run

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SCdF SCdF merged commit 45d7ba3 into main Jan 20, 2026
2 checks passed
@SCdF SCdF deleted the refactor-update-trigger-event-handler branch January 20, 2026 19:54
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