-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Stack blown when nested "@partial-block"-using partial not given a partial block. #1185
Comments
This also affects inline partials. JSFiddle showing this. |
Nested partials is critical to building modular templates. This needs to be addressed on priority. Any workarounds? |
@jaichandra: I think there may be some confusion: this bug is triggered by accidentally not providing a needed partial-block when calling a partial; in this case, Handlebars goes and uses a different partial-block. It should result an error in all cases, just not this error. (Nested partials, when called correctly, work fine; there shouldn't be a need for a workaround.) |
@damncabbage: Ok. May be im confused. Here is an example of what I am trying to do. item.hbs
list-item.hbs
usage:
I got Does this work? |
@jaichandra: I'm treating these as separate bug reports (same symptom, but no idea if it's the same cause), but yes, your example breaks for me with latest-stable. My all-inline-partials example for ease: {{#*inline "outer" }}
{{#>inner}}
<p>{{> @partial-block }}</p>
{{/inner}}
{{/inline}}
{{#*inline "inner" }}
<div>{{> @partial-block }}</div>
{{/inline}}
{{#>outer}}
Hello
{{/outer}} |
@damncabbage I believe that #1243 fixes this bug as well. |
After building the sources and integrating the version built from 7535e48 I get this error: events.js:160
throw er; // Unhandled 'error' event
^
Error: The partial @partial-block could not be found
at Object.invokePartial (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/runtime.js:255:11)
at Object.invokePartialWrapper [as invokePartial] (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/runtime.js:65:39)
at Object.eval (eval at createFunctionContext (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:252:23), <anonymous>:14:28)
at main (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/runtime.js:170:32)
at Object.ret (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/runtime.js:173:12)
at Object.lsg-demo-section (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:467:21)
at Object.invokePartialWrapper [as invokePartial] (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/runtime.js:69:46)
at eval (eval at createFunctionContext (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:252:23), <anonymous>:5:31)
at prog (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/runtime.js:206:12)
at execIteration (<PROJEKT_ROOT>/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:42:19) |
@Dangoo do you get this error with one of the templates from this issue? If not, please post a template the reproduces the error you're seeing. |
@lawnsea No, the given examples work flawlessly. But using @damncabbage example while leaving the content of The strange thing is, that it worked with May you please tag/publish a new release then (compiling the master each time is no fun… 😛 )? |
I just verified that this issue is fixed in 4.0.6 (the original issue). @Dangoo Could you open a new issue if the error you wrote about in #1185 (comment) is not on your side? |
I just hit this in the wild with someone accidentally calling a
@partial-block
-using partial without giving it said partial block.Minimal example:
Produces:
As far as I can tell: the
inner
partial, when not giving a partial-block of its own, will refer to the@partial-block
given to theouter
partial.Tested with Handlebars 4.0.5.
The text was updated successfully, but these errors were encountered: