0

I'm encountering a critical issue in my Blazor Web App developed with .NET 8.0.

The problem occurs when I switch to a different browser tab and then return to the tab with my Blazor app. Every time I do this, the page reloads unexpectedly. This causes significant issues, especially with forms, as any data previously entered is lost when the page reloads. This is problematic because users may need to switch tabs for research or reference, and their form data should remain intact.

Storing and restoring form data after a page reload isn't a feasible solution due to the project's scale.

After some research, which was challenging due to limited documentation, I believe the issue might be related to the SignalR connection. It appears that the SignalR connection is being dropped when the app's tab is inactive, forcing the page to reload whenever it is reopened. The same behavior occurs even when switching to another application and then returning to the browser.

What I would like to achieve is ensuring that the SignalR connection remains active at all times unless the user manually refreshes or closes the tab.

Has anyone encountered this issue, or can you suggest a solution to keep the SignalR connection alive?

Thank you in advance!

Program.cs

https://codeshare.io/62BnL2

6
  • This is not normal behaviour, unless you're away for a long time, so you're probably doing something to cause it. However, no code = no way to tell. Commented Apr 9 at 13:09
  • The codebase is pretty big; at this point, the causes of this could be many. I am now comparing it to a base project, hoping to understand the reasons for this. Commented Apr 9 at 13:45
  • Please provide enough code so others can better understand or reproduce the problem. Commented Apr 9 at 14:04
  • I am uploading some parts of my code to help identify the issue. I tried a new project, and the problem did not persist, therefore, I must be doing something wrong. Which parts of the code should I send? The code is already in production, so I can't easily share big parts of it. Commented Apr 9 at 17:29
  • You need to produce a minimal reproducible example that replicates the problem. Sharing a wall of code out of context is unlikely to get much feedback. Commented Apr 9 at 20:03

1 Answer 1

0

Have you inspected the browser developer console? Or can you enable detailed errors to get more verbose output in the developer console?

I have seen this only once, with one user in our Blazor Server application that is very large code base. I never successfully found the issue. The symptoms might be different than what you are seeing as well. Our one user that was having this was if they were on a different tab for about one minute then returned it would crash the circuit. The console would show an unknown error. It wasn't always 60 seconds either, like sometimes it would be fine. It didn't matter the page etc. Again, it was only one user.

The next day, when I went to put in more effort to troubleshoot it, the problem was gone and has never come back since.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.