-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.4.6, 4.5.2, 5.0
A template context object inside a JS module will be altered by a call to the core/templates render methods. The following code will output not just "foo": "bar" on the browser console, but also all the mustache helper methods and attributes even though the rendering will be called afterwards:
const context = { |
"foo": "bar" |
};
|
console.log(context);
|
const {html, js} = await Templates.renderForPromise('local_myplugin/mytemplate', context); |
This should be avoided because developers are not expecting the objects they are passing to the render function to be altered in general. Especially the fact that the object is being altered before the render function is being called due to the async/await notation is very confusing.
This might be regression caused by MDL-78266 but I didn't have the time to verify, so I did not add an issue reference.
- has been marked as being related by
-
MDL-84090 PR only: MDL-84076 - core/templates JS module alters template context object
-
- Closed
-