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

Hooks call stack broken on Chromium based browsers #22

Closed
alloy opened this issue Jan 5, 2022 · 1 comment
Closed

Hooks call stack broken on Chromium based browsers #22

alloy opened this issue Jan 5, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@alloy
Copy link

alloy commented Jan 5, 2022

I’m on macOS 12.0.1 (x86_64) and am using this example app.

I have tested this on:

  • MS Edge 96.0.1054.62 (Official build) (x86_64)
  • Chromium 85.0.4183.102 (Developer Build) (64-bit)

It does, however, work correctly with Firefox.

Screenshot 2022-01-05 at 13 04 42

@lahmatiy lahmatiy added the bug Something isn't working label Aug 17, 2022
@lahmatiy
Copy link
Owner

The problem arises because the example uses RRT in conjunction with WhyDidYouRender, which patches hook functions, thereby adding an additional entry to the stack trace. Furthermore, SpiderMonkey (Firefox) and V8 generate stack traces differently, which resulted in the WhyDidYouRender wrapper over the hook not being included in the path in Firefox. Path construction in RRT was based on the assumption that all function names in the path should start with "use", which is not always the case. I have revamped this functionality so as not to rely on function names. Now, paths are generated consistently across all browsers.

Chrome:

image

Firefox:

image

You may notice the difference in paths across browsers in a "hook" name before "useState". That's a WDYR wrapper over the React's hook. WDYR tries to set a name for the wrapper function which works for SpiderMonkey but ignored by V8.

Also you may notice a component name in the beginning of a path. That's because of WDYR wraps component functions as well. If you disable WDYR then a path will be shorter by 2 entries and consistent across browsers:

image

Fixes will be available in next release of RRT.

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