From 5d7ee3fa28987491c55bf22d5687bbb7e60e45ca Mon Sep 17 00:00:00 2001 From: Brenden Tuck Date: Wed, 14 Oct 2020 13:35:03 -0400 Subject: [PATCH] fix localstorage "blank-page" bug --- .../static/webclient/js/plugins/goldenlayout.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js index e0122951bb..13a8adf5cf 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js +++ b/evennia/web/webclient/static/webclient/js/plugins/goldenlayout.js @@ -320,7 +320,7 @@ let goldenlayout = (function () { } // store the current layout to the local list of layouts - Object.assign( evenniaGoldenLayouts, { [name] : myLayout.toConfig() }); + evenniaGoldenLayouts[name] = myLayout.toConfig(); activeLayoutName = name; // upload it to the server @@ -347,7 +347,7 @@ let goldenlayout = (function () { // update localstorage localStorage.setItem( "evenniaGoldenLayoutSavedState", JSON.stringify(myLayout.toConfig()) ); - localStorage.setItem( "evenniaGoldenLayoutSavedStateName", JSON.stringify( activeLayoutName ) ); + localStorage.setItem( "evenniaGoldenLayoutSavedStateName", activeLayoutName ); } @@ -708,7 +708,10 @@ let goldenlayout = (function () { // Overwrite the global-variable configuration from // webclient/js/plugins/goldenlayout_default_config.js // with the version from localstorage - Object.assign( evenniaGoldenLayouts, { activeLayoutName : JSON.parse(savedState) } ); + evenniaGoldenLayouts[activeLayoutName] = JSON.parse(savedState); + } else { + localStorage.setItem( "evenniaGoldenLayoutSavedState", JSON.stringify( window.goldenlayout_config ) ); + localStorage.setItem( "evenniaGoldenLayoutSavedStateName", "default-modified" ); } myLayout = new window.GoldenLayout( evenniaGoldenLayouts[activeLayoutName], mainsub );