[bugfix]: fix album artist order and mild race protection
This commit is contained in:
parent
15c6ef382a
commit
c3fcb7487c
2 changed files with 18 additions and 18 deletions
|
@ -108,17 +108,19 @@ export const VirtualInfiniteGrid = forwardRef(
|
||||||
take: end - start,
|
take: end - start,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setItemData((itemData) => {
|
||||||
const newData: any[] = [...itemData];
|
const newData: any[] = [...itemData];
|
||||||
|
|
||||||
let itemIndex = 0;
|
let itemIndex = 0;
|
||||||
for (let rowIndex = start; rowIndex < end; rowIndex += 1) {
|
for (let rowIndex = start; rowIndex < itemCount; rowIndex += 1) {
|
||||||
newData[rowIndex] = data.items[itemIndex];
|
newData[rowIndex] = data.items[itemIndex];
|
||||||
itemIndex += 1;
|
itemIndex += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
setItemData(newData);
|
return newData;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[columnCount, fetchFn, itemData, setItemData],
|
[columnCount, fetchFn, itemCount],
|
||||||
);
|
);
|
||||||
|
|
||||||
const debouncedLoadMoreItems = debounce(loadMoreItems, 500);
|
const debouncedLoadMoreItems = debounce(loadMoreItems, 500);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
AlbumArtistListQuery,
|
AlbumArtistListQuery,
|
||||||
AlbumArtistListResponse,
|
AlbumArtistListResponse,
|
||||||
AlbumArtistListSort,
|
AlbumArtistListSort,
|
||||||
|
ArtistListQuery,
|
||||||
LibraryItem,
|
LibraryItem,
|
||||||
} from '/@/renderer/api/types';
|
} from '/@/renderer/api/types';
|
||||||
import { ALBUMARTIST_CARD_ROWS } from '/@/renderer/components';
|
import { ALBUMARTIST_CARD_ROWS } from '/@/renderer/components';
|
||||||
|
@ -72,16 +73,13 @@ export const AlbumArtistListGridView = ({ itemCount, gridRef }: AlbumArtistListG
|
||||||
|
|
||||||
const fetch = useCallback(
|
const fetch = useCallback(
|
||||||
async ({ skip: startIndex, take: limit }: { skip: number; take: number }) => {
|
async ({ skip: startIndex, take: limit }: { skip: number; take: number }) => {
|
||||||
const queryKey = queryKeys.albumArtists.list(
|
const query: ArtistListQuery = {
|
||||||
server?.id || '',
|
|
||||||
{
|
|
||||||
...filter,
|
...filter,
|
||||||
},
|
|
||||||
{
|
|
||||||
limit,
|
limit,
|
||||||
startIndex,
|
startIndex,
|
||||||
},
|
};
|
||||||
);
|
|
||||||
|
const queryKey = queryKeys.albumArtists.list(server?.id || '', query);
|
||||||
|
|
||||||
const albumArtistsRes = await queryClient.fetchQuery(
|
const albumArtistsRes = await queryClient.fetchQuery(
|
||||||
queryKey,
|
queryKey,
|
||||||
|
|
Reference in a new issue