mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-14 14:40:08 +02:00
fix album group row height resetting on song change
This commit is contained in:
@@ -38,6 +38,7 @@ interface AlbumGroupHeaderProps {
|
||||
setAlbumGroupContentHeight?: (rowIndex: number, height: number) => void;
|
||||
size?: AlbumGroupTextSize;
|
||||
song: Song | undefined;
|
||||
storedContentHeight?: number;
|
||||
}
|
||||
|
||||
export const AlbumGroupHeader = ({
|
||||
@@ -48,6 +49,7 @@ export const AlbumGroupHeader = ({
|
||||
setAlbumGroupContentHeight,
|
||||
size = 'normal',
|
||||
song,
|
||||
storedContentHeight,
|
||||
}: AlbumGroupHeaderProps): ReactElement => {
|
||||
const { t } = useTranslation();
|
||||
const albumGroupItems = useAlbumGroupItems();
|
||||
@@ -121,7 +123,13 @@ export const AlbumGroupHeader = ({
|
||||
resizeObserver.observe(infoEl);
|
||||
|
||||
return () => resizeObserver.disconnect();
|
||||
}, [infoHeight, rowIndex, setAlbumGroupContentHeight]);
|
||||
}, [
|
||||
infoHeight,
|
||||
metadataRows.length,
|
||||
rowIndex,
|
||||
setAlbumGroupContentHeight,
|
||||
storedContentHeight,
|
||||
]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -105,6 +105,7 @@ export const AlbumGroupColumn = (props: ItemTableListInnerColumn) => {
|
||||
setAlbumGroupContentHeight={props.setAlbumGroupContentHeight}
|
||||
size={props.size === 'default' ? 'normal' : props.size}
|
||||
song={item}
|
||||
storedContentHeight={props.albumGroupContentHeights?.get(props.rowIndex)}
|
||||
/>
|
||||
</TableColumnContainer>
|
||||
);
|
||||
|
||||
@@ -1312,7 +1312,7 @@ const BaseItemTableList = ({
|
||||
|
||||
useEffect(() => {
|
||||
setAlbumGroupContentHeights(new Map());
|
||||
}, [baseItemCount, data]);
|
||||
}, [baseItemCount]);
|
||||
|
||||
const totalItemCount = enableHeader ? baseItemCount + 1 : baseItemCount;
|
||||
const [centerContainerWidth, setCenterContainerWidth] = useState(0);
|
||||
|
||||
Reference in New Issue
Block a user