mirror of https://github.com/lidarr/Lidarr
Fixed: Artists table not resizing properly when window size changed
(cherry picked from commit d923d3f106d30d68fd04ddae2a201de041705163) Closes #3373
This commit is contained in:
parent
0f5002338b
commit
77cfd19c43
|
@ -96,6 +96,8 @@ function ArtistIndexTable(props: ArtistIndexTableProps) {
|
||||||
const listRef: React.MutableRefObject<List> = useRef();
|
const listRef: React.MutableRefObject<List> = useRef();
|
||||||
const [measureRef, bounds] = useMeasure();
|
const [measureRef, bounds] = useMeasure();
|
||||||
const [size, setSize] = useState({ width: 0, height: 0 });
|
const [size, setSize] = useState({ width: 0, height: 0 });
|
||||||
|
const windowWidth = window.innerWidth;
|
||||||
|
const windowHeight = window.innerHeight;
|
||||||
|
|
||||||
const rowHeight = useMemo(() => {
|
const rowHeight = useMemo(() => {
|
||||||
return showBanners ? 70 : 38;
|
return showBanners ? 70 : 38;
|
||||||
|
@ -106,8 +108,8 @@ function ArtistIndexTable(props: ArtistIndexTableProps) {
|
||||||
|
|
||||||
if (isSmallScreen) {
|
if (isSmallScreen) {
|
||||||
setSize({
|
setSize({
|
||||||
width: window.innerWidth,
|
width: windowWidth,
|
||||||
height: window.innerHeight,
|
height: windowHeight,
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -120,10 +122,10 @@ function ArtistIndexTable(props: ArtistIndexTableProps) {
|
||||||
|
|
||||||
setSize({
|
setSize({
|
||||||
width: width - padding * 2,
|
width: width - padding * 2,
|
||||||
height: window.innerHeight,
|
height: windowHeight,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [isSmallScreen, scrollerRef, bounds]);
|
}, [isSmallScreen, windowWidth, windowHeight, scrollerRef, bounds]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const currentScrollListener = isSmallScreen ? window : scrollerRef.current;
|
const currentScrollListener = isSmallScreen ? window : scrollerRef.current;
|
||||||
|
|
Loading…
Reference in New Issue