mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-13 01:10:22 +01:00
fix(review): address second CodeRabbit pass
- streamystats: derive toggle enablement from the same effective URL the input renders (locked admin URL no longer disables every switch) - FilterSheet: use the deep-equality rule for toggling that rendering already uses — option objects are recreated across renders - DownloadCard: take t from useTranslation so badge labels re-render on language change - fileOperations: count trickplay bytes in the storage total, matching the per-item size model - PendingAccountSaveModal: warn instead of silently swallowing a failed account save
This commit is contained in:
@@ -37,7 +37,7 @@ export const PendingAccountSaveModal: React.FC = () => {
|
||||
const serverName = pending?.serverName;
|
||||
setPending(null);
|
||||
saveCurrentAccount({ securityType, pinCode, serverName }).catch(
|
||||
() => {},
|
||||
(error) => console.warn("Failed to save account:", error),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { Image } from "expo-image";
|
||||
import { t } from "i18next";
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
TouchableOpacity,
|
||||
@@ -35,6 +35,7 @@ interface DownloadCardProps extends TouchableOpacityProps {
|
||||
}
|
||||
|
||||
export const DownloadCard = ({ process, ...props }: DownloadCardProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { cancelDownload } = useDownload();
|
||||
const router = useRouter();
|
||||
const queryClient = useNetworkAwareQueryClient();
|
||||
|
||||
@@ -193,15 +193,19 @@ export const FilterSheet = <T,>({
|
||||
<View key={index}>
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
// Match the deep-equality rule used to render the selected
|
||||
// state below — option objects are recreated across renders,
|
||||
// so reference checks would re-add an already selected item.
|
||||
const isSelected = values.some((value) => isEqual(value, item));
|
||||
if (multiple) {
|
||||
if (!values.includes(item)) set(values.concat(item));
|
||||
else set(values.filter((v) => v !== item));
|
||||
if (!isSelected) set(values.concat(item));
|
||||
else set(values.filter((value) => !isEqual(value, item)));
|
||||
|
||||
setTimeout(() => {
|
||||
setOpen(false);
|
||||
}, 250);
|
||||
} else {
|
||||
if (!values.includes(item)) {
|
||||
if (!isSelected) {
|
||||
set([item]);
|
||||
setTimeout(() => {
|
||||
setOpen(false);
|
||||
|
||||
Reference in New Issue
Block a user