Skip to content

Conversation

@shiro-all
Copy link

@shiro-all shiro-all bot commented Jun 18, 2025

Summary

This PR fixes a critical issue in the serviceworker.js:

  • Removed shadowing of the global self.
  • Eliminated the duplicate fetch event listener to prevent multiple calls to event.respondWith, which was causing uncaught exceptions and breaking the Service Worker.
  • Consolidated the fetch handler logic into a single listener:
    • Serves cached responses when available.
    • Falls back to network fetch.
    • If both fail (e.g., offline), serves the offline.html page for navigation requests.

Changes

  • Removed const self = this which was incorrectly shadowing the global.
  • Rewrote the fetch listener to handle caching/network/offline fallback properly.

Please review and merge. Once deployed, the site should correctly serve the offline page and have a functioning Service Worker without errors.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great having you contribute to this project

Thank you for your first pull request to Sukoon. 🤓
If you would like to keep contributing to open-source, you can check out the other projects by Susmita Dey here
Any questions, let us know. 🤓

@netlify
Copy link

netlify bot commented Jun 18, 2025

Deploy Preview for sukoon-stress-free ready!

Name Link
🔨 Latest commit ab1ebc8
🔍 Latest deploy log https://app.netlify.com/projects/sukoon-stress-free/deploys/68523402fa8b9f000848ffee
😎 Deploy Preview https://deploy-preview-670--sukoon-stress-free.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Susmita-Dey Susmita-Dey merged commit e4a82d8 into main Jun 18, 2025
5 of 6 checks passed
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