Open miohtama opened 12 years ago
A workaround is to explicitly set template (cache) before calling render()
var template;
// Use different template for the empty cart
// than cart populated with items
if(data.count > 0) {
template = $("#checkout-popup-template");
} else {
// Empty :/
template = $("#checkout-popup-empty-template");
}
// Explicitly set Transparency template
// https://github.com/leonidas/transparency/issues/11
elem.data("template", template);
Workaround isn't valid anymore. I'll write a section to FAQ.
Added a cache busting parameter to render(), should be merged?
https://github.com/miohtama/transparency/commit/03aa310019f53ff43b13a31c13b1b69db24e399a
What's the status on the cache busting feature? Does it exist in transparency.js? Is there a way that you can disable caching?
I have just spent about 3 hours trying to solve this problem, and I didn't figure it out. Can anyone help me? l need it very badly.
Though a rare scenario, there are situations where one would like to use different template for the same DOM node depending on the situation.
Currently Transparency implicitly caches the first applied template on any DOM node:
Meaning that if the context changes e.g. like this:
The change is not automatically reflected.
Possible resolutions out of my head
1) Detect template changes in more smart way
2) Have an public API to explicitly set template (does not need to come from context itself)