Remove obsolete debug props
This commit is contained in:
parent
9b3a5a56a1
commit
f2efe25fe8
@ -7,9 +7,6 @@ import { clsx} from 'clsx/lite';
|
|||||||
import Image, { ImageProps } from 'next/image';
|
import Image, { ImageProps } from 'next/image';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
// If image is still loading after 200ms, force CSS animation
|
|
||||||
const FALLBACK_FADE_CUTOFF = 200;
|
|
||||||
|
|
||||||
export default function ImageWithFallback({
|
export default function ImageWithFallback({
|
||||||
className,
|
className,
|
||||||
classNameImage = 'object-cover h-full',
|
classNameImage = 'object-cover h-full',
|
||||||
@ -19,7 +16,6 @@ export default function ImageWithFallback({
|
|||||||
}: ImageProps & {
|
}: ImageProps & {
|
||||||
blurCompatibilityLevel?: 'none' | 'low' | 'high'
|
blurCompatibilityLevel?: 'none' | 'low' | 'high'
|
||||||
classNameImage?: string
|
classNameImage?: string
|
||||||
debug?: boolean
|
|
||||||
}) {
|
}) {
|
||||||
const { shouldDebugImageFallbacks } = useAppState();
|
const { shouldDebugImageFallbacks } = useAppState();
|
||||||
|
|
||||||
@ -31,17 +27,14 @@ export default function ImageWithFallback({
|
|||||||
const onError = useCallback(() => setDidError(true), []);
|
const onError = useCallback(() => setDidError(true), []);
|
||||||
|
|
||||||
const isLoadingRef = useRef(isLoading);
|
const isLoadingRef = useRef(isLoading);
|
||||||
useEffect(() => {
|
useEffect(() => { isLoadingRef.current = isLoading; }, [isLoading]);
|
||||||
isLoadingRef.current = isLoading;
|
|
||||||
}, [isLoading]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
// If image is still loading, force CSS animation
|
// If image is still loading after 200ms, force CSS animation
|
||||||
if (isLoadingRef.current) {
|
if (isLoadingRef.current) {
|
||||||
setFadeFallbackTransition(true);
|
setFadeFallbackTransition(true);
|
||||||
}
|
}
|
||||||
}, FALLBACK_FADE_CUTOFF);
|
}, 200);
|
||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@ -142,7 +142,6 @@ export default function PhotoDetailPage({
|
|||||||
shouldShareFocalLength={focal !== undefined}
|
shouldShareFocalLength={focal !== undefined}
|
||||||
includeFavoriteInAdminMenu={includeFavoriteInAdminMenu}
|
includeFavoriteInAdminMenu={includeFavoriteInAdminMenu}
|
||||||
showAdminKeyCommands
|
showAdminKeyCommands
|
||||||
debugImageFallback
|
|
||||||
/>,
|
/>,
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -78,7 +78,6 @@ export default function PhotoLarge({
|
|||||||
includeFavoriteInAdminMenu,
|
includeFavoriteInAdminMenu,
|
||||||
onVisible,
|
onVisible,
|
||||||
showAdminKeyCommands,
|
showAdminKeyCommands,
|
||||||
debugImageFallback,
|
|
||||||
}: {
|
}: {
|
||||||
photo: Photo
|
photo: Photo
|
||||||
className?: string
|
className?: string
|
||||||
@ -105,7 +104,6 @@ export default function PhotoLarge({
|
|||||||
includeFavoriteInAdminMenu?: boolean
|
includeFavoriteInAdminMenu?: boolean
|
||||||
onVisible?: () => void
|
onVisible?: () => void
|
||||||
showAdminKeyCommands?: boolean
|
showAdminKeyCommands?: boolean
|
||||||
debugImageFallback?: boolean
|
|
||||||
}) {
|
}) {
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
const refZoomControls = useRef<ZoomControlsRef>(null);
|
const refZoomControls = useRef<ZoomControlsRef>(null);
|
||||||
@ -226,7 +224,6 @@ export default function PhotoLarge({
|
|||||||
blurDataURL={photo.blurData}
|
blurDataURL={photo.blurData}
|
||||||
blurCompatibilityMode={doesPhotoNeedBlurCompatibility(photo)}
|
blurCompatibilityMode={doesPhotoNeedBlurCompatibility(photo)}
|
||||||
priority={priority}
|
priority={priority}
|
||||||
debug={debugImageFallback}
|
|
||||||
/>
|
/>
|
||||||
</ZoomControls>
|
</ZoomControls>
|
||||||
<div className={clsx(
|
<div className={clsx(
|
||||||
|
|||||||
@ -9,14 +9,12 @@ export default function PhotosLarge({
|
|||||||
prefetchFirstPhotoLinks,
|
prefetchFirstPhotoLinks,
|
||||||
onLastPhotoVisible,
|
onLastPhotoVisible,
|
||||||
revalidatePhoto,
|
revalidatePhoto,
|
||||||
debugImageFallback = true,
|
|
||||||
}: {
|
}: {
|
||||||
photos: Photo[]
|
photos: Photo[]
|
||||||
animate?: boolean
|
animate?: boolean
|
||||||
prefetchFirstPhotoLinks?: boolean
|
prefetchFirstPhotoLinks?: boolean
|
||||||
onLastPhotoVisible?: () => void
|
onLastPhotoVisible?: () => void
|
||||||
revalidatePhoto?: RevalidatePhoto
|
revalidatePhoto?: RevalidatePhoto
|
||||||
debugImageFallback?: boolean
|
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<AnimateItems
|
<AnimateItems
|
||||||
@ -37,7 +35,6 @@ export default function PhotosLarge({
|
|||||||
onVisible={index === photos.length - 1
|
onVisible={index === photos.length - 1
|
||||||
? onLastPhotoVisible
|
? onLastPhotoVisible
|
||||||
: undefined}
|
: undefined}
|
||||||
debugImageFallback={debugImageFallback && index === 0}
|
|
||||||
/>)}
|
/>)}
|
||||||
itemKeys={photos.map(photo => photo.id)}
|
itemKeys={photos.map(photo => photo.id)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -23,7 +23,6 @@ export default function PhotosLargeInfinite({
|
|||||||
photos={photos}
|
photos={photos}
|
||||||
onLastPhotoVisible={onLastPhotoVisible}
|
onLastPhotoVisible={onLastPhotoVisible}
|
||||||
revalidatePhoto={revalidatePhoto}
|
revalidatePhoto={revalidatePhoto}
|
||||||
debugImageFallback={false}
|
|
||||||
/>}
|
/>}
|
||||||
</InfinitePhotoScroll>
|
</InfinitePhotoScroll>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user