Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/app/appData.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,12 @@ export async function refetchAppData(appData, persist = false) {
}

/**
* If talk hash is dirty, re-fetch capabilities and userMetadata and update appData
* Re-fetch capabilities and userMetadata with retry and update appData
*
* @param {import('./AppData.js').appData} appData appData
* @return {Promise<void>}
* @throws {Error}
*/
export async function refetchAppDataIfDirty(appData) {
// Re-fetch on dirty Talk hash and any desktop client upgrade
if (!appData.talkHashDirty && packageJson.version === appData.version.desktop) {
return
}

export async function refetchAppDataWithRetry(appData) {
await new Promise((resolve) => {
/**
* Try to re-fetch appData
Expand Down
4 changes: 2 additions & 2 deletions src/welcome/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { appData } from '../app/AppData.js'
import { refetchAppDataIfDirty } from '../app/appData.service.js'
import { refetchAppDataWithRetry } from '../app/appData.service.js'
import { initGlobals } from '../shared/globals/globals.js'
import { applyAxiosInterceptors } from '../shared/setupWebPage.js'

Expand All @@ -31,7 +31,7 @@ applyAxiosInterceptors()

if (appData.credentials) {
await window.TALK_DESKTOP.enableWebRequestInterceptor(appData.serverUrl, { credentials: appData.credentials })
await refetchAppDataIfDirty(appData)
await refetchAppDataWithRetry(appData)
}

window.TALK_DESKTOP.sendAppData(appData.toJSON())
Loading