mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-15 16:20:03 +00:00
Release 2.3.2 (#831)
* Optimize performance of web UI while downloads are active * chore: bump version to v2.3.2-preview * Fix test * Fix GameCover not refreshing until reload * Bump actions/upload-artifact from 4 to 6 (#829) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 6. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/download-artifact from 5 to 7 (#830) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v5...v7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix login redirect issue when behind NPM (#832) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,19 @@ const GameCoverComponent = ({game, size = 300, radius = "sm", interactive = fals
|
||||
const [isImageLoaded, setIsImageLoaded] = useState(isCached);
|
||||
const [blurhashUrl, setBlurhashUrl] = useState<string | undefined>(undefined);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const prevCoverIdRef = useRef<number | undefined>(game.cover?.id);
|
||||
|
||||
// Reset state when cover ID changes
|
||||
useEffect(() => {
|
||||
const currentCoverId = game.cover?.id;
|
||||
if (prevCoverIdRef.current !== currentCoverId) {
|
||||
prevCoverIdRef.current = currentCoverId;
|
||||
const newIsCached = currentCoverId ? loadedImagesCache.has(currentCoverId) : false;
|
||||
setIsImageLoaded(newIsCached);
|
||||
setBlurhashUrl(undefined);
|
||||
setShouldLoad(!lazy);
|
||||
}
|
||||
}, [game.cover?.id, lazy]);
|
||||
|
||||
// Generate blurhash placeholder image
|
||||
useEffect(() => {
|
||||
@@ -116,9 +129,10 @@ const GameCoverComponent = ({game, size = 300, radius = "sm", interactive = fals
|
||||
};
|
||||
|
||||
// Memoize the component to prevent unnecessary re-renders
|
||||
// Only re-render if the game ID, size, radius, interactive, or lazy props change
|
||||
// Only re-render if the game ID, cover ID, size, radius, interactive, or lazy props change
|
||||
export const GameCover = memo(GameCoverComponent, (prevProps, nextProps) => {
|
||||
return prevProps.game.id === nextProps.game.id &&
|
||||
prevProps.game.cover?.id === nextProps.game.cover?.id &&
|
||||
prevProps.size === nextProps.size &&
|
||||
prevProps.radius === nextProps.radius &&
|
||||
prevProps.interactive === nextProps.interactive &&
|
||||
|
||||
Reference in New Issue
Block a user