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

fix: prevent Maximum call stack size exceeded #3816

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

baseballyama
Copy link

@baseballyama baseballyama commented Dec 20, 2024

Attempting to INSERT a large amount of data at once causes a Maximum call stack size exceeded error.
In my case, it occurred with the following:

result.params.push(...query.params);

The minimal code to reproduce this issue is as follows:

const array = [];
const items = Array.from({ length: 110088 }, (_, i) => i + 1);
array.push(...items)

To address this issue, I added a push_array utility to prevent the error.
Regarding performance, I believe the impact is negligible, but is there any benchmark data available to confirm this?

I’d like to add an ESLint rule to inspect the use of array.push(...items) in the future. What do you think? If you agree, I will create a separate PR for it.

@baseballyama baseballyama force-pushed the fix/maximum-call-stack-size-exceeded branch from 6705fbd to a23a4c0 Compare December 27, 2024 17:45
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

Successfully merging this pull request may close these issues.

1 participant