Skip to content

Conversation

@tanmaykapil17
Copy link

@tanmaykapil17 tanmaykapil17 commented Dec 14, 2025

This PR adds the initial groundwork for Progressive Web App (PWA) support.

  • Registers a service worker in the application entry point
  • Lays the foundation for future PWA features such as offline support and caching

This is an incremental change, and further improvements (manifest configuration and service worker enhancements) will be added based on feedback.

Summary by Sourcery

Enhancements:

  • Register a service worker on application load when the browser supports it to lay the groundwork for PWA functionality.

@vercel
Copy link

vercel bot commented Dec 14, 2025

@mtanmaykapil is attempting to deploy a commit to the eventyay Team on Vercel.

A member of the Team first needs to authorize it.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 14, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds initial PWA groundwork by registering a service worker when the app loads, without changing existing application behavior.

Sequence diagram for service worker registration on app load

sequenceDiagram
  actor User
  participant Browser
  participant App
  participant ServiceWorker

  User ->> Browser: Open application URL
  Browser ->> App: Load app.js
  App ->> Browser: Attach window load listener
  Browser -->> User: Render initial UI
  Browser ->> Browser: window load event fires
  Browser ->> ServiceWorker: navigator.serviceWorker.register(/service-worker.js)
  ServiceWorker -->> Browser: Registration promise resolves/rejects
  Browser -->> App: Service worker registration result (unused in this PR)
Loading

File-Level Changes

Change Details Files
Register a service worker after the app loads to prepare for PWA features.
  • Check for service worker support via the navigator object
  • Attach a load event listener on window to defer registration until the page is fully loaded
  • Register the service worker script at /service-worker.js
app/app.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link

We don't accept pull requests from development or testing branch. Please send a pull request from some other branch. Thank You!

@github-actions github-actions bot closed this Dec 14, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The global if ('serviceWorker' in navigator) guard will throw in non-browser environments (e.g., FastBoot or SSR); consider using typeof navigator !== 'undefined' && 'serviceWorker' in navigator or a similar runtime environment check before accessing navigator.
  • You may want to restrict service worker registration to production (or a specific environment/flag) to avoid interfering with local development behavior and caching while iterating.
  • Consider adding basic error handling or logging around navigator.serviceWorker.register('/service-worker.js') so that registration failures are surfaced and easier to debug during rollout.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The global `if ('serviceWorker' in navigator)` guard will throw in non-browser environments (e.g., FastBoot or SSR); consider using `typeof navigator !== 'undefined' && 'serviceWorker' in navigator` or a similar runtime environment check before accessing `navigator`.
- You may want to restrict service worker registration to production (or a specific environment/flag) to avoid interfering with local development behavior and caching while iterating.
- Consider adding basic error handling or logging around `navigator.serviceWorker.register('/service-worker.js')` so that registration failures are surfaced and easier to debug during rollout.

## Individual Comments

### Comment 1
<location> `app/app.js:18-19` </location>
<code_context>
 export default App;
+
+if ('serviceWorker' in navigator) {
+  window.addEventListener('load', () => {
+    navigator.serviceWorker.register('/service-worker.js');
+  });
+}
</code_context>

<issue_to_address>
**suggestion:** Consider adding basic error handling around service worker registration.

If registration fails (e.g., invalid script, wrong path, non-HTTPS), the error is currently ignored. Consider handling the returned promise (via `.then`/`.catch` or `async/await`) and logging/reporting failures:

```js
window.addEventListener('load', () => {
  navigator.serviceWorker
    .register('/service-worker.js')
    .catch((err) => {
      // log or report err
    });
});
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +18 to +19
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js');
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider adding basic error handling around service worker registration.

If registration fails (e.g., invalid script, wrong path, non-HTTPS), the error is currently ignored. Consider handling the returned promise (via .then/.catch or async/await) and logging/reporting failures:

window.addEventListener('load', () => {
  navigator.serviceWorker
    .register('/service-worker.js')
    .catch((err) => {
      // log or report err
    });
});

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.

2 participants