From 94ae9d427842806e629e6d0814f70ba2f0e56494 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Mon, 8 Feb 2021 14:53:07 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20partition=20(and=20thus?= =?UTF-8?q?=20browser=20storage)=20should=20be=20persisted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/desktop/electron-app/src/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js index fd434936e..d811bcf9e 100644 --- a/ui/desktop/electron-app/src/index.js +++ b/ui/desktop/electron-app/src/index.js @@ -38,10 +38,14 @@ app.on('window-all-closed', () => { }); app.on('ready', async () => { - // Register custom protocol - const partition = emberAppName; + // Setup a partition + // Must be prefixed with persist: in order to save things like localStorage + // data. Without this, the session is in-memory only. + // https://www.electronjs.org/docs/api/session#sessionfrompartitionpartition-options + const partition = `persist:${emberAppName}`; const ses = session.fromPartition(partition); + // Register custom protocol ses.protocol.registerFileProtocol(emberAppProtocol, (request, callback) => { const isDir = request.url.endsWith('/'); const absolutePath = request.url.substr(emberAppURL.length);