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

Errors are not forwarded to window.onerror #2621

Open
ACXgit opened this issue Aug 31, 2020 · 1 comment
Open

Errors are not forwarded to window.onerror #2621

ACXgit opened this issue Aug 31, 2020 · 1 comment
Assignees
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage

Comments

@ACXgit
Copy link
Contributor

ACXgit commented Aug 31, 2020

Errors inside components do not reach window.onerror event handler while using the Mithril router, mounting components with m.route. Instead they do when the component is mounted with m.mount.

This didn't happen in 1.x.

Mithril version:
2.0.4

Browser and OS:
Firefox 81 64bit, Windows 10

Code

[flems] m.route with Mithril 1.1.7, working as expected

[flems] m.route with Mithril 2.0.4, not forwarding

[flems] m.mount with Mithril 2.0.4, working as expected

Context

Without errors being forwarded to window.onerror it's impossible to catch them globally and log them, i.e. to an application monitoring and error tracking platform like Sentry.

@ACXgit ACXgit added the Type: Bug For bugs and any other unexpected breakage label Aug 31, 2020
@dead-claudia
Copy link
Member

dead-claudia commented Sep 1, 2020

Found the issue:

  • The initial route isn't #!/, so it has to update the route.
  • Whenever the route updates, it then has to redraw.
  • Redraws are all run in sequence, with errors captured and logged.

I feel the issue may be mitigated in two parts:

  1. Resolve the initial route before mounting, to avoid an initial blank render. Edit: Not necessary. Just the second.
  2. Change async redraws to call requestAnimationFrame once for each root rather than once for all roots, and just use the array of scheduled roots to avoid double-scheduling roots. (It's worth noting no user code can run between animation frame callbacks, and microtasks are delayed until after paint, so this change would likely not be user-breaking.)

@dead-claudia dead-claudia moved this to High priority in Triage/bugs Sep 2, 2024
@dead-claudia dead-claudia added the Area: Core For anything dealing with Mithril core itself label Sep 2, 2024
@dead-claudia dead-claudia mentioned this issue Oct 13, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage
Projects
Status: High priority
Development

No branches or pull requests

2 participants