diff --git a/src/components/ServerConnections.js b/src/components/ServerConnections.js index 3a3d22c056..93aff18584 100644 --- a/src/components/ServerConnections.js +++ b/src/components/ServerConnections.js @@ -6,8 +6,6 @@ import Dashboard from '../utils/dashboard'; import Events from '../utils/events.ts'; import { setUserInfo } from '../scripts/settings/userSettings'; import appSettings from '../scripts/settings/appSettings'; -import viewContainer from './viewContainer'; -import { queryClient } from 'utils/query/queryClient'; const normalizeImageOptions = options => { if (!options.quality && (options.maxWidth || options.width || options.maxHeight || options.height || options.fillWidth || options.fillHeight)) { @@ -43,10 +41,6 @@ class ServerConnections extends ConnectionManager { setUserInfo(null, null); // Ensure the updated credentials are persisted to storage credentialProvider.credentials(credentialProvider.credentials()); - // Reset the query cache - queryClient.resetQueries(); - // Reset cached views - viewContainer.reset(); if (window.NativeShell && typeof window.NativeShell.onLocalUserSignedOut === 'function') { window.NativeShell.onLocalUserSignedOut(logoutInfo); diff --git a/src/utils/dashboard.js b/src/utils/dashboard.js index 4cca230cc2..65c34fc309 100644 --- a/src/utils/dashboard.js +++ b/src/utils/dashboard.js @@ -12,6 +12,8 @@ import DirectoryBrowser from '../components/directorybrowser/directorybrowser'; import dialogHelper from '../components/dialogHelper/dialogHelper'; import itemIdentifier from '../components/itemidentifier/itemidentifier'; import { getLocationSearch } from './url.ts'; +import { queryClient } from './query/queryClient'; +import viewContainer from 'components/viewContainer'; export function getCurrentUser() { return window.ApiClient.getCurrentUser(false); @@ -98,6 +100,10 @@ export function onServerChanged(_userId, _accessToken, apiClient) { export function logout() { ServerConnections.logout().then(function () { + // Clear the query cache + queryClient.clear(); + // Reset cached views + viewContainer.reset(); webSettings.getMultiServer().then(multi => { multi ? navigate('selectserver.html') : navigate('login.html'); });