reactjrx 1.106.0 → 1.107.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/index.cjs
CHANGED
|
@@ -161,9 +161,8 @@ const useSubject = ({
|
|
|
161
161
|
}, [completeOnUnmountRef, onBeforeCompleteRef, subject]);
|
|
162
162
|
return subject;
|
|
163
163
|
};
|
|
164
|
-
const
|
|
164
|
+
const useObservableCallback = () => {
|
|
165
165
|
const subject = useSubject();
|
|
166
|
-
const event$ = useLiveRef(subject.current.asObservable());
|
|
167
166
|
const trigger = React.useCallback(
|
|
168
167
|
(arg) => {
|
|
169
168
|
subject.current.next(arg);
|
|
@@ -171,7 +170,7 @@ const useObserveCallback = () => {
|
|
|
171
170
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
172
171
|
[]
|
|
173
172
|
);
|
|
174
|
-
return [
|
|
173
|
+
return [subject.current, trigger];
|
|
175
174
|
};
|
|
176
175
|
const useBehaviorSubject = (state) => {
|
|
177
176
|
const subject = useConstant(() => new rxjs.BehaviorSubject(state));
|
|
@@ -722,7 +721,7 @@ function useMutation$(options, queryClient) {
|
|
|
722
721
|
const source = typeof options.mutationFn === "function" ? options.mutationFn(variables) : options.mutationFn;
|
|
723
722
|
source.pipe(rxjs.take(1)).subscribe({
|
|
724
723
|
next: (data) => {
|
|
725
|
-
lastData = data;
|
|
724
|
+
lastData = { value: data };
|
|
726
725
|
},
|
|
727
726
|
error: (error) => {
|
|
728
727
|
reject(error);
|
|
@@ -730,7 +729,7 @@ function useMutation$(options, queryClient) {
|
|
|
730
729
|
complete: () => {
|
|
731
730
|
if (lastData === void 0)
|
|
732
731
|
return reject(new Error("Stream completed without any data"));
|
|
733
|
-
resolve(lastData);
|
|
732
|
+
resolve(lastData.value);
|
|
734
733
|
}
|
|
735
734
|
});
|
|
736
735
|
});
|
|
@@ -3517,9 +3516,9 @@ exports.useLiveRef = useLiveRef;
|
|
|
3517
3516
|
exports.useMount = useMount;
|
|
3518
3517
|
exports.useMutation = useMutation;
|
|
3519
3518
|
exports.useMutation$ = useMutation$;
|
|
3519
|
+
exports.useObservableCallback = useObservableCallback;
|
|
3520
3520
|
exports.useObservableState = useObservableState;
|
|
3521
3521
|
exports.useObserve = useObserve;
|
|
3522
|
-
exports.useObserveCallback = useObserveCallback;
|
|
3523
3522
|
exports.usePersistSignals = usePersistSignals;
|
|
3524
3523
|
exports.useQuery = useQuery;
|
|
3525
3524
|
exports.useQuery$ = useQuery$;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './lib/binding/useObserve';
|
|
2
2
|
export * from './lib/binding/useSubscribe';
|
|
3
|
-
export * from './lib/binding/
|
|
3
|
+
export * from './lib/binding/useObservableCallback';
|
|
4
4
|
export * from './lib/binding/useObservableState';
|
|
5
5
|
export * from './lib/binding/useSubject';
|
|
6
6
|
export * from './lib/binding/useBehaviorSubject';
|
package/dist/index.js
CHANGED
|
@@ -143,9 +143,8 @@ const useSubject = ({
|
|
|
143
143
|
}, [completeOnUnmountRef, onBeforeCompleteRef, subject]);
|
|
144
144
|
return subject;
|
|
145
145
|
};
|
|
146
|
-
const
|
|
146
|
+
const useObservableCallback = () => {
|
|
147
147
|
const subject = useSubject();
|
|
148
|
-
const event$ = useLiveRef(subject.current.asObservable());
|
|
149
148
|
const trigger = useCallback(
|
|
150
149
|
(arg) => {
|
|
151
150
|
subject.current.next(arg);
|
|
@@ -153,7 +152,7 @@ const useObserveCallback = () => {
|
|
|
153
152
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
154
153
|
[]
|
|
155
154
|
);
|
|
156
|
-
return [
|
|
155
|
+
return [subject.current, trigger];
|
|
157
156
|
};
|
|
158
157
|
const useBehaviorSubject = (state) => {
|
|
159
158
|
const subject = useConstant(() => new BehaviorSubject(state));
|
|
@@ -704,7 +703,7 @@ function useMutation$(options, queryClient) {
|
|
|
704
703
|
const source = typeof options.mutationFn === "function" ? options.mutationFn(variables) : options.mutationFn;
|
|
705
704
|
source.pipe(take(1)).subscribe({
|
|
706
705
|
next: (data) => {
|
|
707
|
-
lastData = data;
|
|
706
|
+
lastData = { value: data };
|
|
708
707
|
},
|
|
709
708
|
error: (error) => {
|
|
710
709
|
reject(error);
|
|
@@ -712,7 +711,7 @@ function useMutation$(options, queryClient) {
|
|
|
712
711
|
complete: () => {
|
|
713
712
|
if (lastData === void 0)
|
|
714
713
|
return reject(new Error("Stream completed without any data"));
|
|
715
|
-
resolve(lastData);
|
|
714
|
+
resolve(lastData.value);
|
|
716
715
|
}
|
|
717
716
|
});
|
|
718
717
|
});
|
|
@@ -3500,9 +3499,9 @@ export {
|
|
|
3500
3499
|
useMount,
|
|
3501
3500
|
useMutation,
|
|
3502
3501
|
useMutation$,
|
|
3502
|
+
useObservableCallback,
|
|
3503
3503
|
useObservableState,
|
|
3504
3504
|
useObserve,
|
|
3505
|
-
useObserveCallback,
|
|
3506
3505
|
usePersistSignals,
|
|
3507
3506
|
useQuery,
|
|
3508
3507
|
useQuery$,
|
package/package.json
CHANGED