Skip to content

Cache issue when using "abstract" partials #257

@lperrin

Description

@lperrin

I'm using partials to render a tab pane:

<div id="my-tab" class="tab-content">
  <div class="tab-pane active">
    {{> tab1}}
  </div>
  <div class="tab-pane">
    {{> tab2}}
  </div>
</div>

Now, if I do:

$('#my-tab').mustache({}, {
  tab1: '<p>Tab 1 - version A</p>',
  tab2: '<p>Tab 2 - version A</p>'
});

And then later:

$('#my-tab').mustache({}, {
  tab1: '<p>Tab 1 - version B</p>',
  tab2: '<p>Tab 2 - version B</p>'
});

I still get version A because the template has been cached. If that's not a proper use of mustache, it should be explained in the doc because this behaviour wasn't obvious to me until I read the code.

A fix would be to include partials in the key definition of the cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions