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

[Handlebars] Inconsistent data access when leveraging sibling JSON + partial blocks #1498

Open
acarnwath opened this issue Dec 1, 2023 · 0 comments

Comments

@acarnwath
Copy link

When sibling JSON is provided, when leveraging {{@partial-block}}, {{this}} no longer exists consistently.

This is a problem because when leveraging a Handlebars Helper that is not expecting undefined to be passed in, it breaks my build. However, it appears to ultimately render correctly (with the data as expected) if I remove the helper.

For example, I have 2 patterns.

partial-test.hbs

{{> @partial-block }}

test.hbs:

{{log this}} <- outputs the global data

{{#> molecules-partial-test}}
  {{log this}} <- expected to output the global data as well
{{/molecules-partial-test}}

This works as expected... then, when I add in sibling JSON file, I get some weird behavior

test.json

  { "foo": "bar" }

Now, in the console, I see undefined, and then { "foo": "bar" } combined with the global data (from _data/*.json).

The same thing happens if I make a pseudo pattern:

test~pseudo.json

  { "hello": "world" }

Now, in the console (with both JSON files), I see undefined, undefined, and then { "foo": "bar" } and { "hello": "world" } combined with the global data (from _data/*.json).

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

No branches or pull requests

1 participant