Performance sweep (#147)

This commit is contained in:
Gregory Schier
2024-12-20 17:31:15 -08:00
committed by GitHub
parent 42bf016e90
commit 27134a52ad
85 changed files with 2337 additions and 1413 deletions

View File

@@ -1,6 +1,17 @@
import { useParams } from 'react-router-dom';
import { useParams } from '@tanstack/react-router';
import { atom, useAtomValue } from 'jotai';
import { useEffect } from 'react';
import { jotaiStore } from '../routes/__root';
export const activeRequestIdAtom = atom<string>();
export function useActiveRequestId(): string | null {
const { requestId } = useParams();
return requestId ?? null;
return useAtomValue(activeRequestIdAtom) ?? null;
}
export function useSubscribeActiveRequestId() {
const { requestId } = useParams({ strict: false });
useEffect(() => {
jotaiStore.set(activeRequestIdAtom, requestId);
}, [requestId]);
}