Skip to content

Fix : Background sync listener unregistered prematurely on Report Wizard unmount#2160

Merged
dipexplorer merged 1 commit into
RatLoopz:mainfrom
hrx01-dev:fix/Background-sync-listener-unregistered-prematurely-on-Report-Wizardunmount
Jun 20, 2026
Merged

Fix : Background sync listener unregistered prematurely on Report Wizard unmount#2160
dipexplorer merged 1 commit into
RatLoopz:mainfrom
hrx01-dev:fix/Background-sync-listener-unregistered-prematurely-on-Report-Wizardunmount

Conversation

@hrx01-dev

Copy link
Copy Markdown
Contributor

🛑 STOP: Assignment & File Scope Check

  • I am assigned to this issue.
  • I verified that this PR ONLY touches the required files.

Warning

PRs with unrelated files will not be reviewed and may be closed.

📋 PR Summary & Link

  • **Closes [Bug/PWA Sync] Background sync listener unregistered prematurely on Report Wizard unmount #2108 **
  • Summary:
  • Global Syncing (ServiceWorkerProvider.tsx): The initBackgroundSync hook is now initialized when the Service Worker provider mounts on the root layout. This ensures that whenever the user regains internet connectivity—regardless of which page they are on—any pending reports saved locally will auto-sync and they will be notified with a success toast.
  • Local UI Fallback (ReportWizard.tsx): I removed initBackgroundSync from the wizard component. However, the wizard still loads the pending count locally, and it now listens for a new "reports-synced" custom event dispatched by the global provider so that the "pending sync" UI badge instantly reflects changes if the user happens to have the wizard page open while coming back online.

📸 Proof of Work (Screenshots / Logs)

Important

No Pull Request will be merged without proof of testing!

  • Frontend/UI changes: You MUST attach screenshots or screen recordings (GIFs/Videos) showing the UI changes.

Please drag & drop your screenshots/GIFs here:

🏷️ PR Type

  • 🐛 type: bug
  • type: feature
  • 📖 type: docs
  • 🧪 type: testing
  • 🔒 type: security
  • type: performance
  • 🎨 type: design
  • ♻️ type: refactor
  • 🛠️ type: devops
  • type: accessibility

✅ Checklist

  • My PR has a linked issue (Closes #123)
  • I have pulled the latest main and resolved any conflicts

@github-project-automation github-project-automation Bot moved this to 📥 Backlog in SahiDawa Workflow Jun 20, 2026
@github-actions github-actions Bot added gssoc:approved Approved for gssoc good first issue Good for newcomers level:intermediate 35 pts quality:clean multiplier x1.2 status: open-for-all type:bug Something isn't working labels Jun 20, 2026
@dipexplorer dipexplorer added the type:feature New feature or request label Jun 20, 2026
@dipexplorer dipexplorer merged commit 083e615 into RatLoopz:main Jun 20, 2026
14 of 16 checks passed
@github-project-automation github-project-automation Bot moved this from 📥 Backlog to 🎉 Merged in SahiDawa Workflow Jun 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @hrx01-dev! Your Pull Request "Fix : Background sync listener unregistered prematurely on Report Wizard unmount" has been successfully merged by @dipexplorer.

Thank you for your valuable contribution to SahiDawa! 🇮🇳
If this was for GSSoC 2026, your work is officially merged and valid. Keep up the great work and feel free to claim other open issues. 🚀

Follow us on LinkedIn: https://www.linkedin.com/company/ratloopz/ to get shoutout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers gssoc:approved Approved for gssoc level:intermediate 35 pts quality:clean multiplier x1.2 status: open-for-all type:bug Something isn't working type:feature New feature or request

Projects

Status: 🎉 Merged

Development

Successfully merging this pull request may close these issues.

[Bug/PWA Sync] Background sync listener unregistered prematurely on Report Wizard unmount

2 participants