Skip to content

Commit

Permalink
consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed Aug 2, 2024
1 parent fc256b0 commit c63945a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useCallback, useState } from "react";

type useSessionStorageReturn<S> = [
type useSessionPersistenceReturn<S> = [
value: S | undefined,
setValue: (value: S | undefined) => void,
];

export function useSessionStorage<S>(
export function useSessionPersistence<S>(
key: string,
defaultValue: S | undefined = undefined,
): useSessionStorageReturn<S> {
): useSessionPersistenceReturn<S> {
const [storedValue, setStoredValue] = useState(() => {
try {
const value = window.sessionStorage.getItem(key);
Expand Down
4 changes: 2 additions & 2 deletions web/src/views/live/LiveCameraView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import { useNavigate } from "react-router-dom";
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
import useSWR from "swr";
import { cn } from "@/lib/utils";
import { useSessionStorage } from "@/hooks/use-session-state";
import { useSessionPersistence } from "@/hooks/use-session-persistence";

type LiveCameraViewProps = {
config?: FrigateConfig;
Expand Down Expand Up @@ -195,7 +195,7 @@ export default function LiveCameraView({

// playback state

const [audio, setAudio] = useSessionStorage("liveAudio", false);
const [audio, setAudio] = useSessionPersistence("liveAudio", false);
const [mic, setMic] = useState(false);
const [webRTC, setWebRTC] = useState(false);
const [pip, setPip] = useState(false);
Expand Down

0 comments on commit c63945a

Please sign in to comment.