fix(quick-connect): prevent multiple initiations of Quick Connect

This commit is contained in:
fallenbagel
2025-12-09 05:18:49 +08:00
committed by fallenbagel
parent 6c9aaf9777
commit 6000c36c69

View File

@@ -41,6 +41,7 @@ const JellyfinQuickConnectModal = ({
const [isExpired, setIsExpired] = useState(false);
const pollingInterval = useRef<NodeJS.Timeout>();
const isMounted = useRef(true);
const hasInitiated = useRef(false);
useEffect(() => {
isMounted.current = true;
@@ -149,8 +150,12 @@ const JellyfinQuickConnectModal = ({
}, [startPolling, onError, intl]);
useEffect(() => {
initiateQuickConnect();
}, [initiateQuickConnect]);
if (!hasInitiated.current) {
hasInitiated.current = true;
initiateQuickConnect();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const handleTryAgain = () => {
initiateQuickConnect();