Skip to content

Replace unload event with pagehide for sending disconnect beacon from Blazor client #62805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

oroztocil
Copy link
Member

Replaces the unload event with pagehide for sending disconnect beacon from the Blazor client to the server.

The two should fire in (practically) the same situations but pagehide is not deprecated and does not cause warnings for the users.

More fundamental improvements for the circuit cleanup scenarios will be done in later PRs.

Fixes #54793

@Copilot Copilot AI review requested due to automatic review settings July 18, 2025 12:58
@oroztocil oroztocil requested a review from a team as a code owner July 18, 2025 12:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the deprecated unload event with the pagehide event for handling Blazor server disconnect cleanup. The change addresses browser deprecation warnings while maintaining the same functional behavior for circuit cleanup when users navigate away from pages.

  • Replaces unload event listener with pagehide event listener in Blazor server startup code
  • Maintains existing cleanup behavior and event listener options
  • Addresses deprecation warnings without changing the underlying disconnect beacon functionality

@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label Jul 18, 2025
@ilonatommy ilonatommy added this to the 10.0-preview7 milestone Jul 18, 2025
@oroztocil oroztocil changed the title Replace unload event with pagehide for sending disconnect beacon from… Replace unload event with pagehide for sending disconnect beacon from Blazor client Jul 22, 2025
@dotnet dotnet deleted a comment from github-actions bot Jul 22, 2025
@dotnet dotnet deleted a comment from github-actions bot Jul 22, 2025
@oroztocil oroztocil force-pushed the oroztocil/54793-replace-unload-event-for-circuit-cleanup branch from 4c6be66 to 9921213 Compare July 29, 2025 10:40
@oroztocil oroztocil merged commit a400348 into main Jul 29, 2025
30 checks passed
@oroztocil oroztocil deleted the oroztocil/54793-replace-unload-event-for-circuit-cleanup branch July 29, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove usage of the unload event
3 participants