Skip to content
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

🐛 RUM Events cease to publish when beforeUnload event is fired #3032

Open
sukhpreet96 opened this issue Sep 23, 2024 · 3 comments
Open

🐛 RUM Events cease to publish when beforeUnload event is fired #3032

sukhpreet96 opened this issue Sep 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@sukhpreet96
Copy link

Describe the bug
When beforeUnload event is fired, the RUM logs cease to publish. beforeUnload displays a browser modal which prompts the user to leave or stay on the page. In browser-sdk code we are already stopping the RUM events. This should not actually stop the RUM events or logs on before Unload but actually it should be on unload.

To Reproduce
Steps to reproduce the behavior:

  1. fire beforeUnload event
  2. choose to stay on tab
  3. RUM events would stop publishing
    Expected behavior
    The RUM events should keep publishing during beforeUnload and they should actually stop on unload event
@sukhpreet96 sukhpreet96 added the bug Something isn't working label Sep 23, 2024
@sukhpreet96
Copy link
Author

Pull request to fix this issue #3033
@BenoitZugmeyer @amortemousque Requesting a kind review please 🙏

@cy-moi
Copy link
Contributor

cy-moi commented Sep 24, 2024

Hi @sukhpreet96 ,

Thank you for reaching out.

The collection stopping at beforeUnload indeed has some known limitations and we have received your feature request. Yet, unload is not reliable and is deprecated (cf MDN) in favor of pagehide. Hence, we have been looking at different alternatives to beforeUnload or unload to better detect when the page is gone.

Internally, we are having active discussion on this topic and we will keep you updated.

@sukhpreet96
Copy link
Author

sukhpreet96 commented Sep 24, 2024

@cy-moi Thanks for your consideration!
You might be interested in sendBeacon https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon, Refer "Avoid unload and beforeunload" section. This looks promising for usecases like this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants