Blazor WebAssembly Keeps Accumulating Network Data on Page Navigation

Mahir Mirapakayala 0 Reputation points
2025-03-28T06:26:38.78+00:00

Hi everyone,

I'm facing an issue with my Blazor WebAssembly (WASM) application in Chrome. When I navigate between pages, the network data keeps accumulating instead of resetting. I noticed this in the Network tab of DevTools—at the bottom, where it shows resource usage (e.g., 0/7 KB), the data keeps increasing with each navigation.

Even when using browser navigation (back/forward), the previous page’s network data seems to persist and add up instead of clearing out.

Is there a way to prevent this accumulation and ensure that each page load starts fresh without retaining previous network requests?

Thanks in advance!

Blazor Training
Blazor Training
Blazor: A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.Training: Instruction to develop new skills.
31 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Pradeep M 8,185 Reputation points Microsoft External Staff
    2025-03-28T08:47:18.4433333+00:00

    Hi Mahir Mirapakayala,

    Thank you for reaching out to Microsoft Q & A forum. 

    If your Blazor WebAssembly app keeps accumulating network data on navigation, here are some steps to resolve it: 

    1.Use a Singleton HttpClient: Avoid creating a new instance on each request to prevent unnecessary connections. 

    2.Dispose of Resources Properly: Ensure components implement IDisposable to clean up event listeners, timers, or SignalR connections. 

    3.Force Cache Refresh: Append a version query string to the Blazor script to ensure the latest assets load: 

    <script src="_framework/blazor.webassembly.js?version=8"></script>
    
    

    Alternatively, use the Clear-Site-Data: "cache" HTTP header. 

    4.Manually Clear Cache: Reload the page with window.location.reload(true); or unregister service workers: 

    navigator.serviceWorker.getRegistrations().then(regs => regs.forEach(reg => reg.unregister()));
    
    

     5.Check CDN Settings: Ensure your CDN isn’t serving outdated files, which can cause stale data to persist. 

    If the issue continues, try opening the app in Incognito Mode or refreshing with Ctrl+F5 to check for caching problems.     

    If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.        

    0 comments No comments

  2. Bruce (SqlWork.com) 75,051 Reputation points
    2025-03-28T15:27:51.1366667+00:00

    Blazor is a SPA. There is no browser navigation, JavaScript interop updates the dom on Blazor page “navigation”. The devtools only know about real page loads.

    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.