Passing params down template/partial levels
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 461
- PR merge metrics
- No merged PRs in 30d
Description
I have an issue where a partial causes a body function to call it's self recursively causing Chrome and Firefox to throw a 'RangeError: Maximum call stack size exceeded'.
This is the hierarchy of partials I have:
# parent template:
```
{>"start_to_end_date" label="Dates:" name="propertydates" id="propertydates" value="" type="text" size="input-small" data="data-required='required'"/}
```
# start_to_end_date
```
{>"input_text" id="{id}x"/}
```
_note: {id} is from first template_
# input_text
```
```
_note: {id} is from start_to_end_date_
I have debugged the code and found that at the point where {id} is passed from start_to_end_date into input_text it is already a body_4 function which has obviously been complied. So when {id} is read inside input_text the context key id is a function in the tail.head of body_4. So, as the context is not reset it continues passing the id of body_4, and therefore keeps calling its self until the browser throws a warning.
Sorry if I've note explained this very well, i'll try again if needs be. It could be that I'm using partial parameters in the wrong way, but I wanted to check first.
Thanks.
Rich
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the recursive call with the parent template, start_to_end_date partial, and input_text partial shown in the issue. Trace how the id parameter and rendering context are passed between these levels; done should mean the nested partial renders the expected input without exhausting the browser call stack.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100