@pallasoft/ps-core-components 2.49.0 → 2.50.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.
@@ -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: isUnsettled || fetcher.state !== 'idle' || revalidator.state !== 'idle',
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
  };
@@ -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: isUnsettled || fetcher.state !== 'idle' || revalidator.state !== 'idle',
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;
@@ -1,4 +1,5 @@
1
1
  export interface PsOptimisticFetcherResult<Row> {
2
+ isSaving: boolean;
2
3
  rows: Row[];
3
4
  submit: (values: Record<string, string>) => void;
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-core-components",
3
- "version": "2.49.0",
3
+ "version": "2.50.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/esm/index.js",