Open flyingL123 opened 6 years ago
I also just uninstalled and reinstalled stencil cli. Still getting the same error.
Ok, I think I found the issue. The partialRegex
in lib/template-assembler.js
doesn't pick up the partial if there is a json string used as an argument. The reason it was "working" for me on some pages is because I was including the products/grid
partial elsewhere without the json string (when the grid is not being used as a carousel). This caused the parser to pick up that partial, so it worked even though it was picking up the partial from elsewhere on the page.
It looks like the regex needs to be improved so that it picks up a json string, since it's still just a string and I think should be valid.
As a seriously ugly workaround, if I just include a commented out call to the partial at the top of the page, it works, because the assembler still picks it up. For example, at the top of templates/pages/cart.html
I have:
{{!-- {{> components/products/grid }} --}}
This 'fixes' the issue.
I'm using stencil CLI
1.15.1
with node7.9.0
on Mac High Sierra 10.13.1. I'm running into a very odd error that I haven't been able to debug.In
templates/pages/cart.html
, I call a best sellers partial like this:Within
components/cart/best-sellers.html
, I am calling my product grid partial, and attempting to pass it a json string as one of its arguments:I then load the cart page in the browser, and get the following error:
If I remove the json string from the argument, the error goes away:
The strange thing is that I'm using this method in many other places throughout my theme, and it doesn't give me any issues. For example, in
templates/pages/home
, I call the partial:And that file contains:
This works perfectly fine. I can't understand why there is an issue on the cart page, but not any other pages.
As part of debugging, I added the following code at line 214 of
stencil-cli/node_modules/handlebars/dist/cjs/handlebars/runtime.js
in order to see which partials were contained in theoptions
object:When an empty string is used and no error occurs, I get the following output:
However, when I pass in the json string, I get this output, which is missing some partials, including
components/products/grid'
:Can someone explain what is causing this to occur?