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

Stack overflow error #660

Open
stevexbritton opened this issue Oct 17, 2021 · 4 comments
Open

Stack overflow error #660

stevexbritton opened this issue Oct 17, 2021 · 4 comments

Comments

@stevexbritton
Copy link

Hi,

I really like this implementation of frp, but have come across a problem with the following code:

let count = 0
await runEffects(
    tap(
        (it: number | void) => {
            console.log(count++)
            // console.log(`${stackDepth()}`)
            // console.log(new Error().stack)
            // console.trace()
        },
        // periodic(10)
        animationFrames(window)
    ),
    newDefaultScheduler()
)

This causes an "Uncaught RangeError: Maximum call stack size exceeded" after about 11000 cycles in Chrome on a Mac. A similar error occurs in Firefox and Safari just gets bigger.
If I switch from the animationFrames stream to the periodic stream the error does not occur. However, looking at the console.trace produced by Chrome I'm not sure why not.

I know animationFrames is experimental, but I would be grateful if you would have a look at this issue for me. I'm concerned the problem is within the runEffects function and not the animationFrames function.

Thanks in advance,
Steve

@Frikki
Copy link
Member

Frikki commented Nov 19, 2021

@TylorS @briancavalier Do you have any idea of why this is happening?

@stevexbritton
Copy link
Author

Hi,
Thanks for responding. Yes, I know what the problem is. On line 22 of file "x-animation-frame/src/index.js" the code goes recursive with its call to "animationFrames(afp)".
Steve

@Frikki
Copy link
Member

Frikki commented Nov 25, 2021

So we are talking about this line https://github.com/mostjs/x-animation-frame/blob/9e03e9de9640022fd67fbe861b6c6937ced0d040/src/index.js#L22

I’ll see if I get some time to test it. Thanks for opening the issue.

@stevexbritton
Copy link
Author

Yes, you can see it calls itself.
Thanks,
Steve

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

No branches or pull requests

4 participants