Skip to content

Re-work the Pattern Parameter algorithm #769

Closed
@bmuenzenmeyer

Description

@bmuenzenmeyer

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions