mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-27 14:19:01 +03:00
Fix webUI generating HTTP500s when camera disabled (#17305)
* Check camera enabled state before querying go2rtc * lint * Add change to CameraStreamingDialog
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useState, useCallback, useEffect, useMemo } from "react";
|
||||
import { useEnabledState } from "@/api/ws";
|
||||
import { IoIosWarning } from "react-icons/io";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
@@ -63,6 +64,10 @@ export function CameraStreamingDialog({
|
||||
|
||||
// metadata
|
||||
|
||||
// camera enabled state
|
||||
const { payload: enabledState } = useEnabledState(camera);
|
||||
const cameraEnabled = enabledState === "ON";
|
||||
|
||||
const isRestreamed = useMemo(
|
||||
() =>
|
||||
config &&
|
||||
@@ -71,7 +76,7 @@ export function CameraStreamingDialog({
|
||||
);
|
||||
|
||||
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
||||
isRestreamed ? `go2rtc/streams/${streamName}` : null,
|
||||
cameraEnabled && isRestreamed ? `go2rtc/streams/${streamName}` : null,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user