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(pipe.parser): RangeError: Maximum call stack size exceeded on nested templates #34

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

sod
Copy link

@sod sod commented Nov 24, 2023

Thank you so much for maintaining this project!

With #27 we get the exception RangeError: Maximum call stack size exceeded on some templates. The findPipesInNode => extractPipesFromChildNodes => findPipesInNode recursion on a class fails on depth 18, e.g. this template:

<i><i><i><i><i><i><i><i><i><i><i><i><i><i><i><i><i><i>
    {{ 'deep' | translate }}
</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>

Which apparently can happen if you dabble with some nested diffs, forms, bootstrap boilerplate, angular blocks and some ternary to finish it off.

This PR cleans up the recursion via two traversal methods that don't hold much context, allowing to traverse through nested templates (from before depth 18 to ~700 in this PR).

@sod sod force-pushed the call-stack-exceeded branch 2 times, most recently from 19bdf9b to 3eb374a Compare November 26, 2023 02:30
@michaelbromley michaelbromley merged commit eb996e5 into vendure-ecommerce:master Nov 28, 2023
4 checks passed
@michaelbromley
Copy link
Member

Thank you for this PR! I'll make a new release shortly.

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.

2 participants