Fixed: Series posters flickering when width changes repeatedly
Closes #6311
This commit is contained in:
parent
91f33c670e
commit
53cf530893
|
@ -44,7 +44,16 @@ export interface CustomFilter {
|
||||||
filers: PropertyFilter[];
|
filers: PropertyFilter[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AppSectionState {
|
||||||
|
dimensions: {
|
||||||
|
isSmallScreen: boolean;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
interface AppState {
|
interface AppState {
|
||||||
|
app: AppSectionState;
|
||||||
calendar: CalendarAppState;
|
calendar: CalendarAppState;
|
||||||
commands: CommandAppState;
|
commands: CommandAppState;
|
||||||
episodeFiles: EpisodeFilesAppState;
|
episodeFiles: EpisodeFilesAppState;
|
||||||
|
|
|
@ -202,13 +202,18 @@ export default function SeriesIndexPosters(props: SeriesIndexPostersProps) {
|
||||||
if (current) {
|
if (current) {
|
||||||
const width = current.clientWidth;
|
const width = current.clientWidth;
|
||||||
const padding = bodyPadding - 5;
|
const padding = bodyPadding - 5;
|
||||||
|
const finalWidth = width - padding * 2;
|
||||||
|
|
||||||
|
if (Math.abs(size.width - finalWidth) < 20 || size.width === finalWidth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setSize({
|
setSize({
|
||||||
width: width - padding * 2,
|
width: finalWidth,
|
||||||
height: window.innerHeight,
|
height: window.innerHeight,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [isSmallScreen, scrollerRef, bounds]);
|
}, [isSmallScreen, size, scrollerRef, bounds]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const currentScrollerRef = scrollerRef.current as HTMLElement;
|
const currentScrollerRef = scrollerRef.current as HTMLElement;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
|
||||||
function createDimensionsSelector() {
|
function createDimensionsSelector() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state) => state.app.dimensions,
|
(state: AppState) => state.app.dimensions,
|
||||||
(dimensions) => {
|
(dimensions) => {
|
||||||
return dimensions;
|
return dimensions;
|
||||||
}
|
}
|
Loading…
Reference in New Issue