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