mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-16 16:34:24 +02:00
fix list table autosize on row count change
This commit is contained in:
@@ -26,6 +26,10 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-table-grid-container > div[role='grid'] {
|
||||||
|
height: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
.item-table-pinned-rows-container {
|
.item-table-pinned-rows-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ export const PlayQueue = forwardRef<ItemListHandle, QueueProps>(({ listKey, sear
|
|||||||
|
|
||||||
const isFetching = useIsPlayerFetching();
|
const isFetching = useIsPlayerFetching();
|
||||||
const tableRef = useRef<ItemListHandle>(null);
|
const tableRef = useRef<ItemListHandle>(null);
|
||||||
const previousSongCountRef = useRef<number>(0);
|
|
||||||
const mergedRef = useMergedRef(ref, tableRef);
|
const mergedRef = useMergedRef(ref, tableRef);
|
||||||
const { getQueue } = usePlayerActions();
|
const { getQueue } = usePlayerActions();
|
||||||
const queueType = usePlayerQueueType();
|
const queueType = usePlayerQueueType();
|
||||||
@@ -52,7 +51,6 @@ export const PlayQueue = forwardRef<ItemListHandle, QueueProps>(({ listKey, sear
|
|||||||
|
|
||||||
const [data, setData] = useState<QueueSong[]>([]);
|
const [data, setData] = useState<QueueSong[]>([]);
|
||||||
const [groups, setGroups] = useState<TableGroupHeader[]>([]);
|
const [groups, setGroups] = useState<TableGroupHeader[]>([]);
|
||||||
const [containerKey, setContainerKey] = useState<string>(() => Math.random().toString(36));
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const setQueue = () => {
|
const setQueue = () => {
|
||||||
@@ -109,17 +107,6 @@ export const PlayQueue = forwardRef<ItemListHandle, QueueProps>(({ listKey, sear
|
|||||||
};
|
};
|
||||||
}, [getQueue, queueType, tableRef]);
|
}, [getQueue, queueType, tableRef]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const currentCount = data.length;
|
|
||||||
const previousCount = previousSongCountRef.current;
|
|
||||||
|
|
||||||
if (previousCount === 0 && currentCount > 0) {
|
|
||||||
setContainerKey(Math.random().toString(36));
|
|
||||||
}
|
|
||||||
|
|
||||||
previousSongCountRef.current = currentCount;
|
|
||||||
}, [data.length]);
|
|
||||||
|
|
||||||
const filteredData: QueueSong[] = useMemo(() => {
|
const filteredData: QueueSong[] = useMemo(() => {
|
||||||
if (debouncedSearchTerm) {
|
if (debouncedSearchTerm) {
|
||||||
const searched = searchLibraryItems(data, debouncedSearchTerm, LibraryItem.SONG);
|
const searched = searchLibraryItems(data, debouncedSearchTerm, LibraryItem.SONG);
|
||||||
@@ -164,7 +151,7 @@ export const PlayQueue = forwardRef<ItemListHandle, QueueProps>(({ listKey, sear
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container} key={containerKey} ref={containerFocusRef}>
|
<div className={styles.container} ref={containerFocusRef}>
|
||||||
<LoadingOverlay pos="absolute" visible={isFetching} />
|
<LoadingOverlay pos="absolute" visible={isFetching} />
|
||||||
<ItemTableList
|
<ItemTableList
|
||||||
activeRowId={currentSongUniqueId}
|
activeRowId={currentSongUniqueId}
|
||||||
|
|||||||
Reference in New Issue
Block a user