From fb75e911e6a537d98d655095869952f7a6e30fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 22 Jun 2023 15:36:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Gcode=20Viewer:=20Fix=20reload?= =?UTF-8?q?=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/gcodeviewer/static/js/gcodeviewer.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index 0f15a847d..d6e2de825 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -505,14 +505,15 @@ $(function () { }); }; - self.loadFile = function (path, date, size) { + self.loadFile = function (path, date, size, force) { self.enableReload(false); self.needsLoad = false; if ( self.status === "idle" && - self.cachedPath !== path && - self.cachedDate !== date && - self.cachedSize !== size + (force || + (self.cachedPath !== path && + self.cachedDate !== date && + self.cachedSize !== size)) ) { self.status = "request"; @@ -549,7 +550,12 @@ $(function () { self.reload = function () { if (!self.enableReload()) return; - self.loadFile(self.loadedFilepath, self.loadedFileDate, self.loadedFileSize); + self.loadFile( + self.loadedFilepath, + self.loadedFileDate, + self.loadedFileSize, + true + ); }; self.fromHistoryData = function (data) {