snapshot of https://github.com/mountain-loop/yaak.git (main, 2026-09-23; blobs > 131072B omitted)
This commit is contained in:
11
apps/yaak-client/hooks/useActiveRequestId.ts
Normal file
11
apps/yaak-client/hooks/useActiveRequestId.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useSearch } from "@tanstack/react-router";
|
||||
import { atom } from "jotai";
|
||||
import { useEffect } from "react";
|
||||
import { jotaiStore } from "../lib/jotai";
|
||||
|
||||
export const activeRequestIdAtom = atom<string | null>(null);
|
||||
|
||||
export function useSubscribeActiveRequestId() {
|
||||
const { request_id } = useSearch({ strict: false });
|
||||
useEffect(() => jotaiStore.set(activeRequestIdAtom, request_id ?? null), [request_id]);
|
||||
}
|
||||
Reference in New Issue
Block a user