1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #5636 from grafixeyehero/Fix-Clear-query-and-view-cache-on-user-logout

This commit is contained in:
Bill Thornton 2024-05-30 18:22:12 -04:00 committed by GitHub
commit 4129676ed8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -6,8 +6,6 @@ import Dashboard from '../utils/dashboard';
import Events from '../utils/events.ts'; import Events from '../utils/events.ts';
import { setUserInfo } from '../scripts/settings/userSettings'; import { setUserInfo } from '../scripts/settings/userSettings';
import appSettings from '../scripts/settings/appSettings'; import appSettings from '../scripts/settings/appSettings';
import viewContainer from './viewContainer';
import { queryClient } from 'utils/query/queryClient';
const normalizeImageOptions = options => { const normalizeImageOptions = options => {
if (!options.quality && (options.maxWidth || options.width || options.maxHeight || options.height || options.fillWidth || options.fillHeight)) { 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); setUserInfo(null, null);
// Ensure the updated credentials are persisted to storage // Ensure the updated credentials are persisted to storage
credentialProvider.credentials(credentialProvider.credentials()); credentialProvider.credentials(credentialProvider.credentials());
// Reset the query cache
queryClient.resetQueries();
// Reset cached views
viewContainer.reset();
if (window.NativeShell && typeof window.NativeShell.onLocalUserSignedOut === 'function') { if (window.NativeShell && typeof window.NativeShell.onLocalUserSignedOut === 'function') {
window.NativeShell.onLocalUserSignedOut(logoutInfo); window.NativeShell.onLocalUserSignedOut(logoutInfo);

View file

@ -12,6 +12,8 @@ import DirectoryBrowser from '../components/directorybrowser/directorybrowser';
import dialogHelper from '../components/dialogHelper/dialogHelper'; import dialogHelper from '../components/dialogHelper/dialogHelper';
import itemIdentifier from '../components/itemidentifier/itemidentifier'; import itemIdentifier from '../components/itemidentifier/itemidentifier';
import { getLocationSearch } from './url.ts'; import { getLocationSearch } from './url.ts';
import { queryClient } from './query/queryClient';
import viewContainer from 'components/viewContainer';
export function getCurrentUser() { export function getCurrentUser() {
return window.ApiClient.getCurrentUser(false); return window.ApiClient.getCurrentUser(false);
@ -98,6 +100,10 @@ export function onServerChanged(_userId, _accessToken, apiClient) {
export function logout() { export function logout() {
ServerConnections.logout().then(function () { ServerConnections.logout().then(function () {
// Clear the query cache
queryClient.clear();
// Reset cached views
viewContainer.reset();
webSettings.getMultiServer().then(multi => { webSettings.getMultiServer().then(multi => {
multi ? navigate('selectserver.html') : navigate('login.html'); multi ? navigate('selectserver.html') : navigate('login.html');
}); });