How Can I Reduce Network Transfer Delays for JS and CSS files to Minimize Lag in .NET MAUI Hybrid Blazor Applications?

Sale Swift 0 Reputation points
2024-07-16T17:39:09.3466667+00:00

Hi,

I noticed that loading pages takes too long. I followed the Performance tab and observed that the resource duration is excessively long due to network transfer times.

Duration: 2.177s (2.175s network transfer + 1.454ms resource loading)

The resource loading is fast; however, the delay is due to network transfer times. In my project, each navigation requires reloading resources because each tab has its own JavaScript and CSS files. This causes noticeable delays not just at startup, but during every navigation.

Resources (CSS, JS) loading is fast but network transfer takes long time.

Can anyone help with this issue? I've been trying to fix it for a week.

Thanks, SaleSwift.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,501 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,369 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 63,666 Reputation points
    2024-07-16T18:05:31.83+00:00

    couple questions:

    1. why are you loading .css and .js file per blazor page? they are not unloaded, so you are reloading multiple times. while the .js reload will replace existing functions, the .css reload is just additive. this is a poor design, but if you do, you should at least test if already loaded before reloading.
    2. why are these files network based instead of a resource?
    3. do you have caching disabled when dev tools opened?
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.