Fixed: Movie posters flickering when width changes repeatedly

(cherry picked from commit 53cf5308931069638c23925596a3fd8aaccc5d98)

Co-authored-by: Mark McDowall <mark@mcdowall.ca>
pull/9607/head
servarr[bot] 1 year ago committed by GitHub
parent f5914da2f9
commit 1ae98d618c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;
history: HistoryAppState; history: HistoryAppState;

@ -256,13 +256,18 @@ export default function MovieIndexPosters(props: MovieIndexPostersProps) {
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…
Cancel
Save