From 36f8831315049526cdfd86f9e7f574f8eb44b3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 23 Feb 2022 18:58:34 -0500 Subject: [PATCH] refactor: disable cache on templates loadTemplate is called once by benchpress and the result is cache internally --- public/src/ajaxify.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 98845ac07f..1c20521640 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -428,18 +428,14 @@ ajaxify.widgets = { render: render }; ajaxify.loadTemplate = function (template, callback) { $.ajax({ url: `${config.asset_base_url}/templates/${template}.js`, + cache: false, dataType: 'text', success: function (script) { - var context = { - module: { - exports: {}, - }, - }; - // eslint-disable-next-line no-new-func const renderFunction = new Function('module', script); - renderFunction(context.module); - callback(context.module.exports); + const moduleObj = { exports: {} }; + renderFunction(moduleObj); + callback(moduleObj.exports); }, }).fail(function () { console.error('Unable to load template: ' + template);