Add test showing decorator behaviour in deep partials #615
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! this is really a bug report in reproducible form.
I was puzzling over how to replicate the behaviour from the decorator example which writes into the context, when that was happening in partials.
I eventually realised that the decorator is called with the root context, and modifies the root context, rather than the partials own context.
I'm not familiar with the implementation details in this version of handlebars (though I did write
pybars
a long time ago :P - anyhow, if there is a specified way (for instance, there's an jsonpath defining the view the partial is executing with), or some other API to use, that would be great!The use case I have is - I have a data structure that has some poor ergonomics, and I want to derive nicers views on the data, just in time.
As an example, in a template I'd like to write
or other similar things. There might be hundreds of different places in the original data structure that need this done - doing them all in the root template would be a poor fit (a possible workaround I did consider).