From 3a761d7c511b7bd3dbe1fca38ef53e991788f1a8 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Wed, 18 Dec 2019 16:15:15 +0800 Subject: [PATCH] refactor(fragment_cache): reuse result --- lib/plugins/helper/fragment_cache.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plugins/helper/fragment_cache.js b/lib/plugins/helper/fragment_cache.js index 1e794a1482..c8c185154c 100644 --- a/lib/plugins/helper/fragment_cache.js +++ b/lib/plugins/helper/fragment_cache.js @@ -9,8 +9,9 @@ module.exports = ctx => { return function fragmentCache(id, fn) { if (this.cache && cache[id] != null) return cache[id]; - cache[id] = fn(); const result = fn(); + + cache[id] = result; return result; }; };