From d49f266f09868cdeed1eca9548db6dfee5da3f3e Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 18 Jan 2021 12:50:54 -0600 Subject: [PATCH] Do not cache flyout blocks --- src/engine/thread.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/thread.js b/src/engine/thread.js index 528b7637..d9b91fd0 100644 --- a/src/engine/thread.js +++ b/src/engine/thread.js @@ -437,9 +437,11 @@ class Thread { this.triedToCompile = true; + // Do not cache flyout blocks + const useCache = !!blocks.getBlock(this.topBlock); const topBlock = this.topBlock; - const cachedResult = blocks.getCachedCompileResult(topBlock); - // If there is a cached result that indicates, error, do not attempt to compile. + const cachedResult = useCache ? blocks.getCachedCompileResult(topBlock) : null; + // If there is a cached error, do not attempt to recompile. if (cachedResult && !cachedResult.success) { return; } @@ -450,10 +452,14 @@ class Thread { } else { try { result = compile(this); - blocks.cacheCompileResult(topBlock, result); + if (useCache) { + blocks.cacheCompileResult(topBlock, result); + } } catch (error) { log.error('cannot compile script', this.target.getName(), error); - blocks.cacheCompileError(topBlock, error); + if (useCache) { + blocks.cacheCompileError(topBlock, error); + } this.target.runtime.emitCompileError(this.target, error); return; }