Clean up persisted list state when switching servers
This commit is contained in:
parent
fcf00b9de1
commit
48ccebd4c2
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,8 @@ import create from 'zustand';
|
||||||
import { devtools, persist } from 'zustand/middleware';
|
import { devtools, persist } from 'zustand/middleware';
|
||||||
import { immer } from 'zustand/middleware/immer';
|
import { immer } from 'zustand/middleware/immer';
|
||||||
import { AlbumListSort, SongListSort, SortOrder } from '/@/renderer/api/types';
|
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 { useAlbumStore } from '/@/renderer/store/album.store';
|
||||||
import { useSongStore } from '/@/renderer/store/song.store';
|
import { useSongStore } from '/@/renderer/store/song.store';
|
||||||
import { ServerListItem } from '/@/renderer/types';
|
import { ServerListItem } from '/@/renderer/types';
|
||||||
|
@ -56,6 +58,10 @@ export const useAuthStore = create<AuthSlice>()(
|
||||||
sortBy: SongListSort.RECENTLY_ADDED,
|
sortBy: SongListSort.RECENTLY_ADDED,
|
||||||
sortOrder: SortOrder.DESC,
|
sortOrder: SortOrder.DESC,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reset persisted grid list stores
|
||||||
|
useAlbumListDataStore.getState().actions.setItemData([]);
|
||||||
|
useAlbumArtistListDataStore.getState().actions.setItemData([]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue