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

Re-work the Pattern Parameter algorithm #769

Closed
bmuenzenmeyer opened this issue Jan 12, 2018 · 1 comment
Closed

Re-work the Pattern Parameter algorithm #769

bmuenzenmeyer opened this issue Jan 12, 2018 · 1 comment

Comments

@bmuenzenmeyer
Copy link
Member

Async work has exposed what I believe to be a flaw in my pattern parameter algorithm.

Consider the following set of patterns:

paramParent.mustache

{{> test-paramMiddle(class: "foo") }}

paramParent.json

{
  "url" : "link.test-foo"
}

paramMiddle.mustache

<div class="{{class}}">
  {{> test-link }}
</div>

link.mustache

<a href="{{url}}">Click Here for Foo Pattern</a>

Expected Outcome

<div class="foo">
   <a href="../../patterns/test-foo/test-foo.rendered.html">Click Here for Foo Pattern</a>
</div>

Actual Outcome

<div class="foo">
</div>

Analysis

After troubleshooting for a while, I've called into question my decision to consume (i.e. immediately render) patterns when a pattern parameter is present. With async rendering within loops and recursion, this is just a nightmare.

What I am now pivoting to is a replacement of values only.

So we see class patternParameter, we replace the paramMiddle partial to:

<div class="foo">
  {{> test-link }}
</div>

and then carry on with additional resolution. I think this will yield results more consistent with user' expectations.

@bmuenzenmeyer
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant