diff --git a/frontend/src/components/BrowserSession.tsx b/frontend/src/components/BrowserSession.tsx index 5833a51a..17f14e2c 100644 --- a/frontend/src/components/BrowserSession.tsx +++ b/frontend/src/components/BrowserSession.tsx @@ -24,6 +24,7 @@ import { parseUserAgent, sessionNameFromDeviceInformation, } from "../utils/parseUserAgent"; +import { useCurrentBrowserSessionId } from "../utils/session/useCurrentBrowserSessionId"; import EndSessionButton from "./Session/EndSessionButton"; import Session from "./Session/Session"; @@ -92,11 +93,12 @@ export const useEndBrowserSession = ( type Props = { session: FragmentType; - isCurrent: boolean; }; -const BrowserSession: React.FC = ({ session, isCurrent }) => { +const BrowserSession: React.FC = ({ session }) => { + const currentBrowserSessionId = useCurrentBrowserSessionId(); const data = useFragment(BROWSER_SESSION_FRAGMENT, session); + const isCurrent = data.id === currentBrowserSessionId; const onSessionEnd = useEndBrowserSession(data.id, isCurrent); diff --git a/frontend/src/components/BrowserSessionList.tsx b/frontend/src/components/BrowserSessionList.tsx index 5750dc8e..02c0429a 100644 --- a/frontend/src/components/BrowserSessionList.tsx +++ b/frontend/src/components/BrowserSessionList.tsx @@ -27,7 +27,6 @@ import { Pagination, } from "../pagination"; import { isOk, unwrap, unwrapOk } from "../result"; -import { useCurrentBrowserSessionId } from "../utils/session/useCurrentBrowserSessionId"; import BlockList from "./BlockList"; import BrowserSession from "./BrowserSession"; @@ -112,7 +111,6 @@ const paginationFamily = atomFamily((userId: string) => { }); const BrowserSessionList: React.FC<{ userId: string }> = ({ userId }) => { - const currentBrowserSessionId = useCurrentBrowserSessionId(); const [pending, startTransition] = useTransition(); const result = useAtomValue(browserSessionListFamily(userId)); const setPagination = useSetAtom(currentPaginationAtom); @@ -157,11 +155,7 @@ const BrowserSessionList: React.FC<{ userId: string }> = ({ userId }) => { Active only {browserSessions.edges.map((n) => ( - + ))} );