mirror of
https://github.com/moodle/moodle.git
synced 2025-07-19 21:31:32 +02:00
MDL-63667 output: Fix for recursive templates
A template can include itself - e.g. by looping over the context children and rendering a tree. Ensure this promise still resolves. Example: admin/tool/lp/templates/competencies_tree.mustache.
This commit is contained in:
2
lib/amd/build/templates.min.js
vendored
2
lib/amd/build/templates.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -659,7 +659,11 @@ define(['core/mustache',
|
|||||||
|
|
||||||
var cachePartialPromise = this.getTemplate(templateName).then(function(templateSource) {
|
var cachePartialPromise = this.getTemplate(templateName).then(function(templateSource) {
|
||||||
var partials = this.scanForPartials(templateSource);
|
var partials = this.scanForPartials(templateSource);
|
||||||
var fetchThemAll = partials.map(function(partialName) {
|
// Ignore templates that include themselves.
|
||||||
|
var uniquePartials = partials.filter(function(partialName) {
|
||||||
|
return partialName != templateName;
|
||||||
|
});
|
||||||
|
var fetchThemAll = uniquePartials.map(function(partialName) {
|
||||||
return this.cachePartials(partialName);
|
return this.cachePartials(partialName);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user