With the templaterev issue resolved we should enable the prefetch module
when cachejs is enabled to avoid a different experience when cachejs is
enabled vs. disabled.
Previously there was little point in doing this due to a range of other
bugs (string normalisation, and misuse of templaterev).
With these issues resolved we should enabel the caching.
* Subsequent fetches are immediate.
*/
const processQueue = () => {
- if (Config.jsrev <= 0) {
- // No point pre-fetching when cachejs is disabled as we do not store anything in the cache anyway.
- return;
- }
-
if (prefetchTimer) {
// There is a live prefetch timer. The initial prefetch has been scheduled but is not complete.
return;
// First include must be to a module with no dependencies, this prevents multiple requests.
$prefix = 'M.util.js_pending("core/first");';
$prefix .= "require(['core/first'], function() {\n";
- if ($cachejs) {
- $prefix .= "require(['core/prefetch']);\n";
- }
+ $prefix .= "require(['core/prefetch']);\n";
$suffix = 'M.util.js_complete("core/first");';
$suffix .= "\n});";
$output .= html_writer::script($prefix . implode(";\n", $this->amdjscode) . $suffix);