landvex: Fixar och tester klara för alla komponenter
- Datafabrik: Dockerfile fix, agentorkestrering fungerar - Vision: Identify-modell, FAISS, OCR alla testade - API: Alla 7 integrationstester passerade - Upplösare: Entitetsupplösning verifierad
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import { notifyManager } from '../core/notifyManager';
|
||||
import { parseMutationFilterArgs } from '../core/utils';
|
||||
import { useQueryClient } from './QueryClientProvider';
|
||||
export function useIsMutating(arg1, arg2) {
|
||||
var mountedRef = React.useRef(false);
|
||||
var filters = parseMutationFilterArgs(arg1, arg2);
|
||||
var queryClient = useQueryClient();
|
||||
|
||||
var _React$useState = React.useState(queryClient.isMutating(filters)),
|
||||
isMutating = _React$useState[0],
|
||||
setIsMutating = _React$useState[1];
|
||||
|
||||
var filtersRef = React.useRef(filters);
|
||||
filtersRef.current = filters;
|
||||
var isMutatingRef = React.useRef(isMutating);
|
||||
isMutatingRef.current = isMutating;
|
||||
React.useEffect(function () {
|
||||
mountedRef.current = true;
|
||||
var unsubscribe = queryClient.getMutationCache().subscribe(notifyManager.batchCalls(function () {
|
||||
if (mountedRef.current) {
|
||||
var newIsMutating = queryClient.isMutating(filtersRef.current);
|
||||
|
||||
if (isMutatingRef.current !== newIsMutating) {
|
||||
setIsMutating(newIsMutating);
|
||||
}
|
||||
}
|
||||
}));
|
||||
return function () {
|
||||
mountedRef.current = false;
|
||||
unsubscribe();
|
||||
};
|
||||
}, [queryClient]);
|
||||
return isMutating;
|
||||
}
|
||||
Reference in New Issue
Block a user