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

Increase stack trace limit temporarily when tracing hooks back to their caller #30

Closed
chrishayesms opened this issue Apr 5, 2023 · 1 comment

Comments

@chrishayesms
Copy link

Copying your own correspondence to me:

The path is built using a hack based on a stack trace parsing. If it is truncated, then it will not be the full path (the initial parts will be missing, that is, only the tail will be displayed). The stack trace can be truncated by the runtime or a setting like Error.stackTraceLimit (⁠details).

In my case, the trace only goes back 7 or 8 levels, which turns out to not quite get me to the original hook responsible for causing a re-render. It would be great if this can be made to get the full trace regardless of the browser settings.

@lahmatiy
Copy link
Owner

I've observed that the default value for Error.stackTraceLimit is 10 in V8, 50 in Firefox, and 100 in WebKit. Given that the stack trace capturing functionality adds approximately 4 entries to the stack trace, only around 6 entries remain for the hook path. I've refactored this stack trace capturing mechanism. Now, RRT temporarily sets Error.stackTraceLimit to 25 during stack trace capture, ensuring at least 20 path entries. Additionally, RRT employs a different method to extract paths, accommodating cases where a function is either unnamed or its name doesn't begin with use. I'm confident that RRT will now accurately process hook paths in the majority of scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants