PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
70 stars 36 forks source link

"Error: Maximum call stack size exceeded in execute function" #93

Closed ATobolsky closed 1 year ago

ATobolsky commented 1 year ago

Bug description

The code is causing a maximum call stack size exceeded error.

How to reproduce

  1. Load the code that contains the execute function.
  2. Call the execute function passing an array of SnippetArrayItem and thisArg as parameters.
  3. The code will get stuck in an infinite loop, eventually throwing the RangeError: Maximum call stack size exceeded error.

Related sub-libraries

Additional context

The error is occurring in the execute function, which contains a loop that calls itself recursively. This is causing the stack to fill up until it reaches the maximum size allowed by the browser, resulting in the error.

Thank you for your bug report – we love squashing them!

benjackwhite commented 1 year ago

With the current amount of context there isn't much we can advise here. If you can provide more context and code snippets then feel free to re-open.