Optimise cloneDeep usage in string templates
This commit is contained in:
parent
886929b8bc
commit
64855bbdf0
|
@ -54,8 +54,9 @@ module.exports.processJS = (handlebars, context) => {
|
||||||
// Our $ context function gets a value from context.
|
// Our $ context function gets a value from context.
|
||||||
// We clone the context to avoid mutation in the binding affecting real
|
// We clone the context to avoid mutation in the binding affecting real
|
||||||
// app context.
|
// app context.
|
||||||
|
const clonedContext = cloneDeep(context)
|
||||||
const sandboxContext = {
|
const sandboxContext = {
|
||||||
$: path => getContextValue(path, cloneDeep(context)),
|
$: path => getContextValue(path, clonedContext),
|
||||||
helpers: getJsHelperList(),
|
helpers: getJsHelperList(),
|
||||||
|
|
||||||
// Proxy to evaluate snippets when running in the browser
|
// Proxy to evaluate snippets when running in the browser
|
||||||
|
|
Loading…
Reference in New Issue