mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
remove non-functional playqueue sizing workaround
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { useDebouncedValue } from '@mantine/hooks';
|
import { useDebouncedValue } from '@mantine/hooks';
|
||||||
import { nanoid } from 'nanoid/non-secure';
|
import { forwardRef, useMemo } from 'react';
|
||||||
import { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
||||||
|
|
||||||
import { ItemTableList } from '/@/renderer/components/item-list/item-table-list/item-table-list';
|
import { ItemTableList } from '/@/renderer/components/item-list/item-table-list/item-table-list';
|
||||||
import { ItemTableListColumn } from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
import { ItemTableListColumn } from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||||
@@ -40,35 +39,6 @@ export const PlayQueue = forwardRef<ItemListHandle, QueueProps>(({ listKey, sear
|
|||||||
return queue;
|
return queue;
|
||||||
}, [queue, debouncedSearchTerm]);
|
}, [queue, debouncedSearchTerm]);
|
||||||
|
|
||||||
const playQueueKeyRef = useRef({
|
|
||||||
alreadyRendered: false,
|
|
||||||
key: nanoid(),
|
|
||||||
prevLength: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (playQueueKeyRef.current.alreadyRendered && playQueueKeyRef.current.prevLength === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.length === 0) {
|
|
||||||
playQueueKeyRef.current = {
|
|
||||||
alreadyRendered: false,
|
|
||||||
key: nanoid(),
|
|
||||||
prevLength: data.length,
|
|
||||||
};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.length > 0 && !playQueueKeyRef.current.alreadyRendered) {
|
|
||||||
playQueueKeyRef.current = {
|
|
||||||
alreadyRendered: true,
|
|
||||||
key: nanoid(),
|
|
||||||
prevLength: data.length,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}, [data.length, playQueueKeyRef]);
|
|
||||||
|
|
||||||
const isEmpty = data.length === 0;
|
const isEmpty = data.length === 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -93,7 +63,6 @@ export const PlayQueue = forwardRef<ItemListHandle, QueueProps>(({ listKey, sear
|
|||||||
type: 'offset',
|
type: 'offset',
|
||||||
}}
|
}}
|
||||||
itemType={LibraryItem.QUEUE_SONG}
|
itemType={LibraryItem.QUEUE_SONG}
|
||||||
key={playQueueKeyRef.current.key}
|
|
||||||
ref={ref}
|
ref={ref}
|
||||||
size={table.size}
|
size={table.size}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user