`RangeError: Maximum call stack size exceeded` in `@angular/animations` module

🐞 bug report

Affected Package

The issue is caused by package @angular/animations

Is this a regression?

Not sure

Description

We sometimes see RangeError: Maximum call stack size exceeded error in our production environment. Some of them come from Safari, some from Chrome. I'm attaching a few last frames of the stacktrace (see the section below). I think this is the reason for the issue: https://anchortagdev.com/range-error-maximum-call-stack-size-exceeded-error-using-spread-operator-in-node-js-javascript. Looks like it happens when page contains a lot of DOM elements and code tries to push them all into an array using a spread operator.

🔬 Minimal Reproduction

Sorry, I don't know how to reproduce it.

🔥 Exception or Error

image

🌍 Your Environment

Angular Version:




Angular CLI: 9.1.5
Node: 12.16.1
OS: darwin x64

Angular: 9.1.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router, upgrade
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.5
@angular-devkit/build-angular     0.901.5
@angular-devkit/build-optimizer   0.901.5
@angular-devkit/build-webpack     0.901.5
@angular-devkit/core              7.3.10
@angular-devkit/schematics        7.3.10
@angular/cdk                      9.2.3
@angular/cli                      9.1.5
@ngtools/webpack                  9.1.5
@schematics/angular               9.1.5
@schematics/update                0.901.5
rxjs                              6.5.5
typescript                        3.7.5
webpack                           4.43.0