mirror of https://github.com/sveltejs/svelte
[fix] prevent maximum call stack size exceeded error on large pages (#7203)
Co-authored-by: milahu <milahu@gmail.com> Co-authored-by: Simon <simon.holthausen@accso.de> Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>pull/7217/head
parent
d1b3f462a5
commit
be3d82733f
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Pushes all `items` into `array` using `push`, therefore mutating the array.
|
||||
* We do this for memory and perf reasons, and because `array.push(...items)` would
|
||||
* run into a "max call stack size exceeded" error with too many items (~65k).
|
||||
* @param array
|
||||
* @param items
|
||||
*/
|
||||
export function push_array<T>(array: T[], items: T[]): void {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
array.push(items[i]);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue