Replies: 2 comments 3 replies
-
There's an Passing a whitelist of variables but not all (globals) is not a typical scenario though. To my understanding, it's more about tracing. I noticed there's a Does this approach help? What's your thoughts on this? |
Beta Was this translation helpful? Give feedback.
-
Using symbols to add "private" variables to a render context and reading those private variables from custom tags - as you have done - seems like a perfectly valid approach to me. As does manipulating the render context prior to rendering a partial template from a custom version of the If you haven't already, consider implementing your async data loading and caching in a drop, possibly instead of custom tags, depending on what else those tags might be doing. |
Beta Was this translation helpful? Give feedback.
-
Hi and thank you for this amazing template engine.
I created asynchronous tags that load data. I would need to connect calls to these tags, to the
renderFile
that initiates the rendering. This way, I can implement a cache system that is aware of the dependencies of generated HTML (so the cache system knows when to invalidate generated HTML).What I did
I was able to achieve it, this way:
RenderTag
:I used the code from the repository, with a modification:
The hidden property is passed through child contexts, using a
env
variable.Questions
I would like to know if the way I found is correct and perennial, or if this is more like a hack, and then, there is a risk that it won't work some day after an upgrade.
Also, a better way would be something provided by the template engine. I imagine something like that:
…then, from the implementation of the tag, we could simply use it from a property
ctx.passThroughScope
.Beta Was this translation helpful? Give feedback.
All reactions