question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Blazor-Wasm-PWA] Service Worker downloads redundant files making the initial resource download size double

See original GitHub issue

Description:

It might be a non-issue but being a noob in blazor I tried to search for answers everywhere on the internet without any luck of finding answer/issue mentioned anywhere, so I decided to post it here

I built an blazor wasm pwa app and hosted it on Github pages: Here is the url: https://paragraut.github.io/ComicsAppWasm/

What I saw in initial load of the website on let’s say incognito mode I see redundant downloads of same files, one was loaded by default and one was loaded by service worker as shown below

image

Making download size double than original

My question is: Is it normal ? does service worker always worked this way ?

To Reproduce

To reproduce it go to incognito mode and open network tab on developer options, then navigate to https://paragraut.github.io/ComicsAppWasm/ and observer same resource files being downloaded twice.

Not just on GitHub Pages but when I also tried to host it on IIS I faced same issue.

Technical details

  • ASP.NET Core version : 3.1.300
  • Output of dotnet --info

.NET Core SDK (reflecting any global.json): Version: 3.1.300 Commit: b2475c1295

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.300\

Host (useful for support): Version: 3.1.4 Commit: 0c2e69caa6

.NET Core SDKs installed: 3.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

IDE

  • Visual Studio 16.6.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
javiercncommented, Jun 9, 2020

@ParagRaut It is not part of the standard framework, it is likely a transitive dependency on a package you might have installed and that’s why its there. Blazor uses System.Text.Json by default.

1reaction
javiercncommented, Jun 9, 2020

@ParagRaut thanks for contacting us.

One download corresponds to the app loading and another one corresponds to the service worker caching the downloaded assets while getting installed.

AFAIK there is no way to prevent that, since the app needs to be independent of the service worker being present or not. Once the service worker is installed or after the first visit, you shouldn’t see any duplicate downloads

Read more comments on GitHub >

github_iconTop Results From Across the Web

Huge content download time for a resource from service ...
I am intercepting and returning a resource from service worker cache. It takes around 300-400ms to download the content as per Google Chrome ......
Read more >
Host and deploy ASP.NET Core Blazor WebAssembly
Learn how to host and deploy Blazor WebAssembly using ASP.NET Core, Content Delivery Networks (CDN), file servers, and GitHub Pages.
Read more >
Chapter 4. Service Worker Lifecycle and Cache Management
The service worker file downloads and starts installing. The install event gets dispatched, triggering our function that logs the occasion to the console....
Read more >
CycleTracker: Service workers - Progressive web apps | MDN
The service worker is what makes the application work offline while making ... PWA will not know it needs to download updated resources....
Read more >
Angular Service Worker - Step-By-Step Guide
In this post, we will cover how we can configure the Angular CLI build pipeline to generate applications that in production mode are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found