mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-16 16:34:24 +02:00
Set 1 minute cache time on manual query fetches
This commit is contained in:
@@ -103,16 +103,19 @@ export const AlbumArtistListContent = ({ gridRef, tableRef }: AlbumArtistListCon
|
|||||||
...page.filter,
|
...page.filter,
|
||||||
});
|
});
|
||||||
|
|
||||||
const albumArtistsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const albumArtistsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getAlbumArtistList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getAlbumArtistList({
|
||||||
startIndex,
|
query: {
|
||||||
...page.filter,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...page.filter,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const albums = api.normalize.albumArtistList(albumArtistsRes, server);
|
const albums = api.normalize.albumArtistList(albumArtistsRes, server);
|
||||||
@@ -192,16 +195,19 @@ export const AlbumArtistListContent = ({ gridRef, tableRef }: AlbumArtistListCon
|
|||||||
...page.filter,
|
...page.filter,
|
||||||
});
|
});
|
||||||
|
|
||||||
const albumArtistsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const albumArtistsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getAlbumArtistList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getAlbumArtistList({
|
||||||
startIndex,
|
query: {
|
||||||
...page.filter,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...page.filter,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
return api.normalize.albumArtistList(albumArtistsRes, server);
|
return api.normalize.albumArtistList(albumArtistsRes, server);
|
||||||
|
|||||||
@@ -123,16 +123,19 @@ export const AlbumArtistListHeader = ({ gridRef, tableRef }: AlbumArtistListHead
|
|||||||
...filters,
|
...filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const albums = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const albums = await queryClient.fetchQuery(
|
||||||
api.controller.getAlbumArtistList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getAlbumArtistList({
|
||||||
startIndex,
|
query: {
|
||||||
...filters,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...filters,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
return api.normalize.albumArtistList(albums, server);
|
return api.normalize.albumArtistList(albums, server);
|
||||||
@@ -157,16 +160,19 @@ export const AlbumArtistListHeader = ({ gridRef, tableRef }: AlbumArtistListHead
|
|||||||
...filters,
|
...filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const albumArtistsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const albumArtistsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getAlbumArtistList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getAlbumArtistList({
|
||||||
startIndex,
|
query: {
|
||||||
...filters,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...filters,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const albumArtists = api.normalize.albumArtistList(albumArtistsRes, server);
|
const albumArtists = api.normalize.albumArtistList(albumArtistsRes, server);
|
||||||
|
|||||||
@@ -103,17 +103,20 @@ export const PlaylistDetailSongListContent = ({ tableRef }: PlaylistDetailConten
|
|||||||
...filters,
|
...filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const songsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const songsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getPlaylistSongList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
id: playlistId,
|
api.controller.getPlaylistSongList({
|
||||||
limit,
|
query: {
|
||||||
startIndex,
|
id: playlistId,
|
||||||
...filters,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...filters,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const songs = api.normalize.songList(songsRes, server);
|
const songs = api.normalize.songList(songsRes, server);
|
||||||
|
|||||||
@@ -138,17 +138,20 @@ export const PlaylistDetailSongListHeader = ({
|
|||||||
...filters,
|
...filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const songsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const songsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getPlaylistSongList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
id: playlistId,
|
api.controller.getPlaylistSongList({
|
||||||
limit,
|
query: {
|
||||||
startIndex,
|
id: playlistId,
|
||||||
...filters,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...filters,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const songs = api.normalize.songList(songsRes, server);
|
const songs = api.normalize.songList(songsRes, server);
|
||||||
|
|||||||
@@ -85,16 +85,19 @@ export const PlaylistListContent = ({ tableRef }: PlaylistListContentProps) => {
|
|||||||
...page.filter,
|
...page.filter,
|
||||||
});
|
});
|
||||||
|
|
||||||
const playlistsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const playlistsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getPlaylistList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getPlaylistList({
|
||||||
startIndex,
|
query: {
|
||||||
...page.filter,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...page.filter,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const playlists = api.normalize.playlistList(playlistsRes, server);
|
const playlists = api.normalize.playlistList(playlistsRes, server);
|
||||||
|
|||||||
@@ -88,16 +88,19 @@ export const PlaylistListHeader = ({ tableRef }: PlaylistListHeaderProps) => {
|
|||||||
...pageFilters,
|
...pageFilters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const playlistsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const playlistsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getPlaylistList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getPlaylistList({
|
||||||
startIndex,
|
query: {
|
||||||
...pageFilters,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...pageFilters,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const playlists = api.normalize.playlistList(playlistsRes, server);
|
const playlists = api.normalize.playlistList(playlistsRes, server);
|
||||||
|
|||||||
@@ -86,16 +86,19 @@ export const SongListContent = ({ tableRef }: SongListContentProps) => {
|
|||||||
...page.filter,
|
...page.filter,
|
||||||
});
|
});
|
||||||
|
|
||||||
const songsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const songsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getSongList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getSongList({
|
||||||
startIndex,
|
query: {
|
||||||
...page.filter,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...page.filter,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const songs = api.normalize.songList(songsRes, server);
|
const songs = api.normalize.songList(songsRes, server);
|
||||||
|
|||||||
@@ -118,16 +118,19 @@ export const SongListHeader = ({ tableRef }: SongListHeaderProps) => {
|
|||||||
...pageFilters,
|
...pageFilters,
|
||||||
});
|
});
|
||||||
|
|
||||||
const songsRes = await queryClient.fetchQuery(queryKey, async ({ signal }) =>
|
const songsRes = await queryClient.fetchQuery(
|
||||||
api.controller.getSongList({
|
queryKey,
|
||||||
query: {
|
async ({ signal }) =>
|
||||||
limit,
|
api.controller.getSongList({
|
||||||
startIndex,
|
query: {
|
||||||
...pageFilters,
|
limit,
|
||||||
},
|
startIndex,
|
||||||
server,
|
...pageFilters,
|
||||||
signal,
|
},
|
||||||
}),
|
server,
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
|
{ cacheTime: 1000 * 60 * 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
const songs = api.normalize.songList(songsRes, server);
|
const songs = api.normalize.songList(songsRes, server);
|
||||||
|
|||||||
Reference in New Issue
Block a user