You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerstate: has PR
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
When upgrading from v17 to v18, our components with large svg templates with template bindings failed to load with a RangeError: Maximum call stack size exceeded. We were able to get rid of this error by reducing the size of the template. I have created a stackblitz that shows this the same template (a random svg seating chart I found online) works on v17 and not on v18.
RangeError: Maximum call stack size exceeded
at executeTemplate (core.mjs:11264:5)
at renderView (core.mjs:12426:7)
at renderComponent (core.mjs:12372:3)
at renderChildComponents (core.mjs:12472:5)
at renderView (core.mjs:12454:7)
at createAndRenderEmbeddedLView (core.mjs:12493:5)
at TemplateRef2.createEmbeddedViewImpl (core.mjs:13419:27)
at ViewContainerRef2.createEmbeddedView (core.mjs:16880:33)
Please provide the environment you discovered this bug in (run ng version)
Interesting, that overflows TS's stack during emit.
You can reduce the stack depth by inserting <ng-container></ng-container> halfway the SVG as a workaround.
Just reporting back that this does indeed fix the issue we had. Random <ng-container></ng-container> in the svg. Though in our case, it took more than one.
I opened #57069 to limit the chaining depth. The diff is small so you may be able to patch it in locally to see if it resolves the issue without needing the ng-container elements.
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerstate: has PR
Activity
JoostK commentedon Jul 21, 2024
The v18 StackBlitz works fine for me, using Chrome in StackBlitz.
Nabelops commentedon Jul 21, 2024
Yeah it is working for me too now. I will work on a better reproduction.
Nabelops commentedon Jul 21, 2024
I have updated the links. They are using a more complex svg now. https://commons.wikimedia.org/wiki/File:European_Parliament_Strasbourg_seating_chart.svg
JoostK commentedon Jul 21, 2024
Interesting, that overflows TS's stack during emit.
You can reduce the stack depth by inserting
<ng-container></ng-container>halfway the SVG as a workaround.Nabelops commentedon Jul 21, 2024
Interesting, if I remember correctly, ng container used to not work in svgs
Nabelops commentedon Jul 21, 2024
Just reporting back that this does indeed fix the issue we had. Random
<ng-container></ng-container>in the svg. Though in our case, it took more than one.JoostK commentedon Jul 21, 2024
I opened #57069 to limit the chaining depth. The diff is small so you may be able to patch it in locally to see if it resolves the issue without needing the
ng-containerelements.fix(compiler): limit the number of chained instructions
fix(compiler): limit the number of chained instructions (#57069)
fix(compiler): limit the number of chained instructions (angular#57069)
fix(compiler): limit the number of chained instructions (angular#57069)
angular-automatic-lock-bot commentedon Aug 22, 2024
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.