Giter Site home page Giter Site logo

[BUG] PWABuilder Report Card is not recognizing the service worker running (site: https://pwhl-remix.vercel.app/) about pwabuilder HOT 4 CLOSED

smoak avatar smoak commented on June 15, 2024
[BUG] PWABuilder Report Card is not recognizing the service worker running (site: https://pwhl-remix.vercel.app/)

from pwabuilder.

Comments (4)

Jaylyn-Barbee avatar Jaylyn-Barbee commented on June 15, 2024

On first load of your site, I don't see a service worker registered. It isn't until I refresh that your service worker loads and is activated. Since it is a bot looking for your SW and it's not loading on the first pass, this could be why your SW isn't being detected.

image

Update: I have been playing with this for a few more minutes and the behavior is a bit different across browsers and even in incognito. Going to get some more people on the team to mess around with this to double check.

from pwabuilder.

khmyznikov avatar khmyznikov commented on June 15, 2024

@smoak @Jaylyn-Barbee getting same behaviour in Edge and Kiwi Mobile. After 5-6 refreshes I have finally got the SW in Edge. Clean website data and check your app logic. In Chrome I can't reproduce this... Try to not use windows load event at all in sw registration.
image
Update: yeah, it's definitely a problem in this event. It's triggers before this code and never executes.
image

from pwabuilder.

jgw96 avatar jgw96 commented on June 15, 2024

As this is an issue in yalls service worker, I am going to close this issue for now, but please feel free to open a new issue if you make our suggested changes and still hit issues. Thanks for using PWABuilder!

from pwabuilder.

smoak avatar smoak commented on June 15, 2024

Try to not use windows load event at all in sw registration.

@khmyznikov Can you help me understand why I shouldn't use this? The workbox docs suggests waiting until the page is fully loaded before registering the service worker

2024-03-07_13-54

Further documentation suggests this as well:

If a service worker precaches anything, then the time at which it's registered matters. Service workers are often registered using inline <script> elements. This means HTML parsers may discover service worker registration code before the page's critical assets have loaded.

This is a problem. A service worker should ideally be performance-neutral in the worst of cases, not make performance worse. Do users a favor and register a service worker when the page's load event fires. This reduces the chance that precaching will interfere with loading a page's critical assets, which in turn means the page can get interactive faster without having to contend with network requests for assets that may not be needed until later anyway.

from pwabuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.