From 293f7f6df77475a1bffce18a56b8c23425b50ce8 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 10 Mar 2021 11:03:30 +0100 Subject: [PATCH] Unload autosave on turbolinks page render. We cannot use turbolinks:request-start because this will duplicate code (if a page is first requested by turbolinks and afterwards by a full page reload) --- app/assets/javascripts/editor/editor.js.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 6d370ee7..87140329 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -889,6 +889,7 @@ var CodeOceanEditor = { this.initializeDeadlines(); CodeOceanEditorTips.initializeEventHandlers(); + window.addEventListener("turbolinks:before-render", this.unloadAutoSave.bind(this)); window.addEventListener("beforeunload", this.unloadAutoSave.bind(this)); // create autosave when the editor is opened the first time this.autosave();