Clean up persisted list state when switching servers

This commit is contained in:
jeffvli 2023-01-15 21:10:06 -08:00
parent fcf00b9de1
commit 48ccebd4c2

View File

@ -4,6 +4,8 @@ import create from 'zustand';
import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
import { AlbumListSort, SongListSort, SortOrder } from '/@/renderer/api/types';
import { useAlbumArtistListDataStore } from '/@/renderer/store/album-artist-list-data.store';
import { useAlbumListDataStore } from '/@/renderer/store/album-list-data.store';
import { useAlbumStore } from '/@/renderer/store/album.store';
import { useSongStore } from '/@/renderer/store/song.store';
import { ServerListItem } from '/@/renderer/types';
@ -56,6 +58,10 @@ export const useAuthStore = create<AuthSlice>()(
sortBy: SongListSort.RECENTLY_ADDED,
sortOrder: SortOrder.DESC,
});
// Reset persisted grid list stores
useAlbumListDataStore.getState().actions.setItemData([]);
useAlbumArtistListDataStore.getState().actions.setItemData([]);
}
});
},