MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / useLoggedCallsCount

Function useLoggedCallsCount

app/src/utils/hooks.ts:337–370  ·  view source on GitHub ↗
(options?: { filters?: FilterData[]; disabled?: boolean })

Source from the content-addressed store, hash-verified

335};
336
337export const useLoggedCallsCount = (options?: { filters?: FilterData[]; disabled?: boolean }) => {
338 const selectedProjectId = useSelectedProject().data?.id;
339
340 const generalFilters = useFilters().filters;
341 const dateFilters = useDateFilter().filters;
342
343 const filtersWithValues = removeEmptyFilters(
344 options?.filters ?? [...dateFilters, ...generalFilters],
345 );
346
347 const setMatchingLogsCount = useAppStore((state) => state.selectedLogs.setMatchingLogsCount);
348
349 const result = api.loggedCalls.getMatchingCount.useQuery(
350 {
351 projectId: selectedProjectId ?? "",
352 filters: filtersWithValues,
353 },
354 {
355 enabled: !!selectedProjectId && !options?.disabled,
356 refetchOnWindowFocus: false,
357 trpc: {
358 context: {
359 slowBatch: true,
360 },
361 },
362 },
363 );
364
365 useEffect(() => {
366 if (!result.isFetching) setMatchingLogsCount(result.data?.count ?? 0);
367 }, [result, setMatchingLogsCount]);
368
369 return result;
370};
371
372export const useTotalNumLogsSelected = () => {
373 const matchingCount = useAppStore((state) => state.selectedLogs.matchingLogsCount);

Callers 4

SecondaryFiltersFunction · 0.90
InitialResultsFunction · 0.90
TableHeaderFunction · 0.90
LoggedCallsPaginatorFunction · 0.90

Calls 4

useFiltersFunction · 0.90
useDateFilterFunction · 0.90
useSelectedProjectFunction · 0.85
removeEmptyFiltersFunction · 0.85

Tested by

no test coverage detected