@pallasoft/ps-core-components 2.49.0 → 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/hooks/use-ps-optimistic-fetcher.js +3 -2
- package/dist/esm/hooks/use-ps-optimistic-save.js +1 -1
- package/dist/hooks/use-ps-optimistic-fetcher.js +3 -2
- package/dist/hooks/use-ps-optimistic-save.js +1 -1
- package/dist/interfaces/ps-optimistic-fetcher-result.d.ts +1 -0
- package/dist/interfaces/ps-optimistic-save-result.d.ts +1 -0
- package/package.json +1 -1
|
@@ -9,10 +9,11 @@ export const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSu
|
|
|
9
9
|
const dataBefore = useRef(fetcher.data);
|
|
10
10
|
const dataSeen = useRef(fetcher.data);
|
|
11
11
|
const failure = useRef(null);
|
|
12
|
+
const isSaving = isUnsettled || fetcher.state !== 'idle';
|
|
12
13
|
const { forgetLast, remember, rows: shown, } = usePsOptimisticRows({
|
|
13
14
|
apply,
|
|
14
15
|
isHolding,
|
|
15
|
-
isSaving:
|
|
16
|
+
isSaving: isSaving || revalidator.state !== 'idle',
|
|
16
17
|
rows,
|
|
17
18
|
});
|
|
18
19
|
useEffect(() => {
|
|
@@ -100,5 +101,5 @@ export const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSu
|
|
|
100
101
|
remember(values);
|
|
101
102
|
queue.enqueue(values);
|
|
102
103
|
}, [queue, remember]);
|
|
103
|
-
return { rows: shown, submit };
|
|
104
|
+
return { isSaving, rows: shown, submit };
|
|
104
105
|
};
|
|
@@ -14,5 +14,5 @@ export const usePsOptimisticSave = ({ fetcher, isSuccess, onError, revalidator,
|
|
|
14
14
|
const { submit } = optimistic;
|
|
15
15
|
const save = useCallback((values, existingId) => submit(PsOptimisticSaveService.saveValues(spec, values, existingId, scopeId)), [scopeId, spec, submit]);
|
|
16
16
|
const remove = useCallback((ids) => submit(PsOptimisticSaveService.removeValues(spec, ids)), [spec, submit]);
|
|
17
|
-
return { remove, rows: optimistic.rows, save };
|
|
17
|
+
return { isSaving: optimistic.isSaving, remove, rows: optimistic.rows, save };
|
|
18
18
|
};
|
|
@@ -12,10 +12,11 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
12
12
|
const dataBefore = (0, react_1.useRef)(fetcher.data);
|
|
13
13
|
const dataSeen = (0, react_1.useRef)(fetcher.data);
|
|
14
14
|
const failure = (0, react_1.useRef)(null);
|
|
15
|
+
const isSaving = isUnsettled || fetcher.state !== 'idle';
|
|
15
16
|
const { forgetLast, remember, rows: shown, } = (0, react_2.usePsOptimisticRows)({
|
|
16
17
|
apply,
|
|
17
18
|
isHolding,
|
|
18
|
-
isSaving:
|
|
19
|
+
isSaving: isSaving || revalidator.state !== 'idle',
|
|
19
20
|
rows,
|
|
20
21
|
});
|
|
21
22
|
(0, react_1.useEffect)(() => {
|
|
@@ -103,6 +104,6 @@ const usePsOptimisticFetcher = ({ apply, fetcher, isHolding = false, isSuccess,
|
|
|
103
104
|
remember(values);
|
|
104
105
|
queue.enqueue(values);
|
|
105
106
|
}, [queue, remember]);
|
|
106
|
-
return { rows: shown, submit };
|
|
107
|
+
return { isSaving, rows: shown, submit };
|
|
107
108
|
};
|
|
108
109
|
exports.usePsOptimisticFetcher = usePsOptimisticFetcher;
|
|
@@ -17,6 +17,6 @@ const usePsOptimisticSave = ({ fetcher, isSuccess, onError, revalidator, rows, s
|
|
|
17
17
|
const { submit } = optimistic;
|
|
18
18
|
const save = (0, react_1.useCallback)((values, existingId) => submit(ps_utilities_1.PsOptimisticSaveService.saveValues(spec, values, existingId, scopeId)), [scopeId, spec, submit]);
|
|
19
19
|
const remove = (0, react_1.useCallback)((ids) => submit(ps_utilities_1.PsOptimisticSaveService.removeValues(spec, ids)), [spec, submit]);
|
|
20
|
-
return { remove, rows: optimistic.rows, save };
|
|
20
|
+
return { isSaving: optimistic.isSaving, remove, rows: optimistic.rows, save };
|
|
21
21
|
};
|
|
22
22
|
exports.usePsOptimisticSave = usePsOptimisticSave;
|