From 15878f500c11a1bc497fe67b771a0e59b3035f1d Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 16 Nov 2022 23:26:25 +0100 Subject: [PATCH] Switch order of unloading the autosave timer Hypothesis: When unloadAutoSave was called, we first saved (causing this.autosaveTimer to become null) and then tried to clearTimeout on this variable (= on null). This probably never worked? Hopefully closes CODEOCEAN-B5 --- app/assets/javascripts/editor/submissions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/editor/submissions.js b/app/assets/javascripts/editor/submissions.js index 7c580131..8e143923 100644 --- a/app/assets/javascripts/editor/submissions.js +++ b/app/assets/javascripts/editor/submissions.js @@ -76,7 +76,7 @@ CodeOceanEditorSubmissions = { if (file_id_old != null && data.files){ // if we find file_id_old (this is the reference to the base file) in the submission, this is the match for(var j = 0; j< data.files.length; j++){ - if(data.files[j].file_id == file_id_old){ + if(data.files[j].file_id === file_id_old){ //$(editors[i].container).data('id') = data.files[j].id; $(this.editors[i].container).data('id', data.files[j].id ); } @@ -230,8 +230,8 @@ CodeOceanEditorSubmissions = { unloadAutoSave: function() { if(this.autosaveTimer != null){ - this.autosave(); clearTimeout(this.autosaveTimer); + this.autosave(); } },