consistent naming

This commit is contained in:
Josh Hawkins 2024-08-02 08:49:39 -05:00
parent fc256b0572
commit c63945a7d2
2 changed files with 5 additions and 5 deletions

View File

@ -1,14 +1,14 @@
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
type useSessionStorageReturn<S> = [ type useSessionPersistenceReturn<S> = [
value: S | undefined, value: S | undefined,
setValue: (value: S | undefined) => void, setValue: (value: S | undefined) => void,
]; ];
export function useSessionStorage<S>( export function useSessionPersistence<S>(
key: string, key: string,
defaultValue: S | undefined = undefined, defaultValue: S | undefined = undefined,
): useSessionStorageReturn<S> { ): useSessionPersistenceReturn<S> {
const [storedValue, setStoredValue] = useState(() => { const [storedValue, setStoredValue] = useState(() => {
try { try {
const value = window.sessionStorage.getItem(key); const value = window.sessionStorage.getItem(key);

View File

@ -78,7 +78,7 @@ import { useNavigate } from "react-router-dom";
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
import useSWR from "swr"; import useSWR from "swr";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { useSessionStorage } from "@/hooks/use-session-state"; import { useSessionPersistence } from "@/hooks/use-session-persistence";
type LiveCameraViewProps = { type LiveCameraViewProps = {
config?: FrigateConfig; config?: FrigateConfig;
@ -195,7 +195,7 @@ export default function LiveCameraView({
// playback state // playback state
const [audio, setAudio] = useSessionStorage("liveAudio", false); const [audio, setAudio] = useSessionPersistence("liveAudio", false);
const [mic, setMic] = useState(false); const [mic, setMic] = useState(false);
const [webRTC, setWebRTC] = useState(false); const [webRTC, setWebRTC] = useState(false);
const [pip, setPip] = useState(false); const [pip, setPip] = useState(false);