Purge zero case no more namespaces

master
Bel LaPointe 2021-02-28 01:21:09 -06:00
parent 3b9fd7a543
commit 13fc57eacb
1 changed files with 11 additions and 5 deletions

View File

@ -3109,8 +3109,10 @@
globalStorage.del(k); globalStorage.del(k);
}); });
popAllNamespaces(namespace); popAllNamespaces(namespace);
setGlobalStorage(getAllNamespaces()[0]); var namespaces = getAllNamespaces();
return false; fallbackNamespace = namespaces[0];
setGlobalStorage(fallbackNamespace);
return true;
}); });
$('.config .switch-namespace').click(function() { $('.config .switch-namespace').click(function() {
@ -3277,7 +3279,6 @@
setCurrentNamespace(namespace); setCurrentNamespace(namespace);
updateNamespaceIndex(); updateNamespaceIndex();
console.log("set global storage and current namespace to: " + namespace);
// //
if (globalStorage.get('nullboard.theme') == 'dark') if (globalStorage.get('nullboard.theme') == 'dark')
@ -3293,9 +3294,11 @@
// //
var board_id = globalStorage.get('nullboard.last_board'); var board_id = globalStorage.get('nullboard.last_board');
document.board = null;
if (board_id) if (board_id)
document.board = loadBoard(board_id); document.board = loadBoard(board_id);
updateBoardIndex(); updateBoardIndex();
if (! document.board && ! $('.config .load-board').length) if (! document.board && ! $('.config .load-board').length)
@ -3345,12 +3348,15 @@
function getAllNamespaces() function getAllNamespaces()
{ {
return JSON.parse(new Local().get("namespaces") || '["initial"]') || ["initial"]; var namespaces = new Local().get("namespaces");
if (! namespaces || namespaces == "[]")
namespaces = "[\"initial\"]";
return JSON.parse(namespaces);
} }
function getCurrentNamespace() function getCurrentNamespace()
{ {
return new Local().get("namespace") || getAllNamespaces[0]; return new Local().get("namespace") || getAllNamespaces()[0];
} }
setGlobalStorage(getCurrentNamespace()); setGlobalStorage(getCurrentNamespace());