diff --git a/src/add-to-ipfs.js b/src/add-to-ipfs.js index cb73b8f81..ff32e95ff 100644 --- a/src/add-to-ipfs.js +++ b/src/add-to-ipfs.js @@ -69,6 +69,8 @@ function sendNotification (failures, successes, launchWebUI, path) { } fn({ title, body }, () => { + // force refresh for Files screen to pick up newly added items + // https://github.com/ipfs/ipfs-desktop/issues/1763 launchWebUI(link, { forceRefresh: true }) }) } diff --git a/src/webui/index.js b/src/webui/index.js index 7430f3d6f..e929fb208 100644 --- a/src/webui/index.js +++ b/src/webui/index.js @@ -107,15 +107,16 @@ module.exports = async function (ctx) { logger.info('[web ui] launching web ui') } else { logger.info(`[web ui] navigate to ${path}`) - window.webContents.send('updatedPage', path) url.hash = path + window.webContents.loadURL(url.toString()) } - if (focus) { window.show() window.focus() dock.show() } + // quick fix for visual jitter on windows + window.webContents.loadURL(url.toString()) } function updateLanguage () { diff --git a/src/webui/preload.js b/src/webui/preload.js index 08c6d48d5..7f88613f0 100644 --- a/src/webui/preload.js +++ b/src/webui/preload.js @@ -10,9 +10,11 @@ const urlParams = new URLSearchParams(window.location.search) function checkIfVisible () { if (document.hidden) { + if (window.location.hash === '#/blank') return // skip, already blank previousHash = window.location.hash window.location.hash = '/blank' } else { + if (previousHash === '#/blank') return // skip window.location.hash = previousHash } } @@ -28,11 +30,6 @@ window.localStorage.setItem = function () { let previousHash = null -ipcRenderer.on('updatedPage', (_, url) => { - previousHash = url - window.location.hash = url -}) - document.addEventListener('visibilitychange', () => { checkIfVisible() }) @@ -41,6 +38,12 @@ document.addEventListener('DOMContentReady', () => { checkIfVisible() }) +// track hash changes, so checkIfVisible always has the right previousHash +document.addEventListener('hashchange', () => { + if (window.location.hash === '#/blank') return // skip + previousHash = window.location.hash +}) + window.ipfsDesktop = { countlyAppKey: COUNTLY_KEY,