MCPcopy Create free account
hub / github.com/DTStack/dt-react-component / performFetch

Function performFetch

src/useList/index.ts:72–85  ·  view source on GitHub ↗
(raw = params)

Source from the content-addressed store, hash-verified

70 const options = useMemo(() => merge({ immediate: true }, rawOptions), [rawOptions]);
71
72 const performFetch = (raw = params) => {
73 const requestId = Symbol('id');
74 lastRequestId.current = requestId;
75 setLoading(true);
76 fetcher(raw)
77 .then(({ data, total }) => {
78 setData(data);
79 setTotal(total);
80 })
81 .catch(setError)
82 .finally(() => {
83 lastRequestId.current === requestId && setLoading(false);
84 });
85 };
86
87 const mutate = (next: Partial<P> | ((prev: P) => P) = params, options: IMutateOptions = {}) => {
88 const defaultOptions: IMutateOptions = {

Callers 2

mutateFunction · 0.85
useListFunction · 0.85

Calls 1

fetcherFunction · 0.50

Tested by

no test coverage detected