Compare commits

..

1 Commits

Author SHA1 Message Date
Gauvain
947d2e4ff3 fix(hooks): correct useMemo dependency arrays
Two memos read values missing from their dependency arrays:
- TrackSheet: the MediaStreams filter uses streamType (add it).
- LibraryItemCard: the route memo uses api (add it).
Prevents stale memoized values when those inputs change (e.g. api after re-login).
2026-06-01 01:00:12 +02:00
5 changed files with 5 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ export const TrackSheet: React.FC<Props> = ({
const streams = useMemo(
() => source?.MediaStreams?.filter((x) => x.Type === streamType),
[source],
[source, streamType],
);
const selectedSteam = useMemo(

View File

@@ -51,7 +51,7 @@ export const LibraryItemCard: React.FC<Props> = ({ library, ...props }) => {
api,
item: library,
}),
[library],
[api, library],
);
const itemType = useMemo(() => {

View File

@@ -229,7 +229,7 @@ export const LibraryOptionsSheet: React.FC<Props> = ({
/>
</OptionGroup>
<OptionGroup title={t("library.options.options_title")}>
<OptionGroup title='Options'>
<ToggleItem
label={t("library.options.show_titles")}
value={settings.showTitles}

View File

@@ -1,13 +1,11 @@
import { useTranslation } from "react-i18next";
import { MpvPlayerViewProps } from "./MpvPlayer.types";
export default function MpvPlayerView(props: MpvPlayerViewProps) {
const url = props.source?.url ?? "";
const { t } = useTranslation();
return (
<div>
<iframe
title={t("player.mpv_player_title")}
title='MPV Player'
style={{ flex: 1 }}
src={url}
onLoad={() => props.onLoad?.({ nativeEvent: { url } })}

View File

@@ -652,8 +652,7 @@
"poster": "Poster",
"cover": "Cover",
"show_titles": "Show Titles",
"show_stats": "Show Stats",
"options_title": "Options"
"show_stats": "Show Stats"
},
"filters": {
"genres": "Genres",
@@ -683,7 +682,6 @@
},
"player": {
"live": "LIVE",
"mpv_player_title": "MPV Player",
"error": "Error",
"failed_to_get_stream_url": "Failed to get the stream URL",
"an_error_occured_while_playing_the_video": "An error occurred while playing the video. Check logs in settings.",