reactjrx 1.40.0 → 1.40.1
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
|
@@ -242,7 +242,6 @@ const PersistSignals = react.memo(
|
|
|
242
242
|
).pipe(rxjs.map(() => true));
|
|
243
243
|
return stream.pipe(
|
|
244
244
|
rxjs.tap(() => {
|
|
245
|
-
console.log("hydration complete");
|
|
246
245
|
if (onReadyRef.current != null)
|
|
247
246
|
onReadyRef.current();
|
|
248
247
|
}),
|
|
@@ -1053,17 +1052,17 @@ const registerResultInCache = ({
|
|
|
1053
1052
|
serializedKey,
|
|
1054
1053
|
options
|
|
1055
1054
|
}) => (stream) => stream.pipe(
|
|
1056
|
-
rxjs.tap((
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1055
|
+
rxjs.tap(({ data }) => {
|
|
1056
|
+
if (data == null ? void 0 : data.result) {
|
|
1057
|
+
const result = data == null ? void 0 : data.result;
|
|
1058
|
+
queryStore.update(serializedKey, {
|
|
1059
|
+
...options.cacheTime !== 0 && {
|
|
1060
|
+
cache_fnResult: { result }
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1062
1064
|
})
|
|
1063
1065
|
);
|
|
1064
|
-
const mapWithComplete = (mapFn) => (stream) => {
|
|
1065
|
-
return stream.pipe(rxjs.map(mapFn({ isComplete: false })));
|
|
1066
|
-
};
|
|
1067
1066
|
const createQueryFetch = ({
|
|
1068
1067
|
options$,
|
|
1069
1068
|
options,
|
|
@@ -1097,12 +1096,8 @@ const createQueryFetch = ({
|
|
|
1097
1096
|
lastFetchedAt: (/* @__PURE__ */ new Date()).getTime()
|
|
1098
1097
|
});
|
|
1099
1098
|
}),
|
|
1100
|
-
|
|
1101
|
-
mapWithComplete(({ isComplete }) => (result) => ({
|
|
1099
|
+
rxjs.map((result) => ({
|
|
1102
1100
|
status: "success",
|
|
1103
|
-
...isComplete && {
|
|
1104
|
-
fetchStatus: "idle"
|
|
1105
|
-
},
|
|
1106
1101
|
data: { result },
|
|
1107
1102
|
error: void 0
|
|
1108
1103
|
})),
|
|
@@ -1121,7 +1116,8 @@ const createQueryFetch = ({
|
|
|
1121
1116
|
error
|
|
1122
1117
|
});
|
|
1123
1118
|
}),
|
|
1124
|
-
notifyQueryResult(options$)
|
|
1119
|
+
notifyQueryResult(options$),
|
|
1120
|
+
registerResultInCache({ serializedKey, options, queryStore })
|
|
1125
1121
|
);
|
|
1126
1122
|
const newCache$ = queryStore.queryEvent$.pipe(
|
|
1127
1123
|
rxjs.filter(
|
|
@@ -1309,11 +1305,9 @@ const createQueryListener = (store, onQuery) => store.store$.pipe(
|
|
|
1309
1305
|
);
|
|
1310
1306
|
return rxjs.merge(rxjs.NEVER, rxjs.of(key)).pipe(
|
|
1311
1307
|
rxjs.tap(() => {
|
|
1312
|
-
console.log("QUERY", key, "in");
|
|
1313
1308
|
}),
|
|
1314
1309
|
onQuery,
|
|
1315
1310
|
rxjs.finalize(() => {
|
|
1316
|
-
console.log("QUERY", key, "complete");
|
|
1317
1311
|
}),
|
|
1318
1312
|
rxjs.takeUntil(deleted$)
|
|
1319
1313
|
);
|
|
@@ -1541,7 +1535,7 @@ const createClient = () => {
|
|
|
1541
1535
|
const serializedKey = serializeKey(key);
|
|
1542
1536
|
const internalRefetch$ = new rxjs.Subject();
|
|
1543
1537
|
const fn$ = maybeFn$ ?? (maybeFn ? rxjs.of(maybeFn) : rxjs.NEVER);
|
|
1544
|
-
|
|
1538
|
+
Logger.log("query$()", serializedKey);
|
|
1545
1539
|
const runner$ = options$.pipe(rxjs.map((options) => ({ options })));
|
|
1546
1540
|
let deleteRunner = () => {
|
|
1547
1541
|
};
|
|
@@ -1566,7 +1560,7 @@ const createClient = () => {
|
|
|
1566
1560
|
}),
|
|
1567
1561
|
rxjs.map(([value, deleteRunnerFn]) => {
|
|
1568
1562
|
deleteRunner = deleteRunnerFn;
|
|
1569
|
-
|
|
1563
|
+
Logger.log("reactjrx", serializedKey, "query trigger", {
|
|
1570
1564
|
trigger: value.trigger,
|
|
1571
1565
|
options: value.options
|
|
1572
1566
|
});
|
|
@@ -1604,9 +1598,6 @@ const createClient = () => {
|
|
|
1604
1598
|
return !shouldStop;
|
|
1605
1599
|
}, true),
|
|
1606
1600
|
rxjs.map(([result]) => result),
|
|
1607
|
-
rxjs.tap((result) => {
|
|
1608
|
-
console.log("result", result);
|
|
1609
|
-
}),
|
|
1610
1601
|
rxjs.finalize(() => {
|
|
1611
1602
|
deleteRunner();
|
|
1612
1603
|
})
|
package/dist/index.js
CHANGED
|
@@ -240,7 +240,6 @@ const PersistSignals = memo(
|
|
|
240
240
|
).pipe(map(() => true));
|
|
241
241
|
return stream.pipe(
|
|
242
242
|
tap(() => {
|
|
243
|
-
console.log("hydration complete");
|
|
244
243
|
if (onReadyRef.current != null)
|
|
245
244
|
onReadyRef.current();
|
|
246
245
|
}),
|
|
@@ -1051,17 +1050,17 @@ const registerResultInCache = ({
|
|
|
1051
1050
|
serializedKey,
|
|
1052
1051
|
options
|
|
1053
1052
|
}) => (stream) => stream.pipe(
|
|
1054
|
-
tap((
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1053
|
+
tap(({ data }) => {
|
|
1054
|
+
if (data == null ? void 0 : data.result) {
|
|
1055
|
+
const result = data == null ? void 0 : data.result;
|
|
1056
|
+
queryStore.update(serializedKey, {
|
|
1057
|
+
...options.cacheTime !== 0 && {
|
|
1058
|
+
cache_fnResult: { result }
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1060
1062
|
})
|
|
1061
1063
|
);
|
|
1062
|
-
const mapWithComplete = (mapFn) => (stream) => {
|
|
1063
|
-
return stream.pipe(map(mapFn({ isComplete: false })));
|
|
1064
|
-
};
|
|
1065
1064
|
const createQueryFetch = ({
|
|
1066
1065
|
options$,
|
|
1067
1066
|
options,
|
|
@@ -1095,12 +1094,8 @@ const createQueryFetch = ({
|
|
|
1095
1094
|
lastFetchedAt: (/* @__PURE__ */ new Date()).getTime()
|
|
1096
1095
|
});
|
|
1097
1096
|
}),
|
|
1098
|
-
|
|
1099
|
-
mapWithComplete(({ isComplete }) => (result) => ({
|
|
1097
|
+
map((result) => ({
|
|
1100
1098
|
status: "success",
|
|
1101
|
-
...isComplete && {
|
|
1102
|
-
fetchStatus: "idle"
|
|
1103
|
-
},
|
|
1104
1099
|
data: { result },
|
|
1105
1100
|
error: void 0
|
|
1106
1101
|
})),
|
|
@@ -1119,7 +1114,8 @@ const createQueryFetch = ({
|
|
|
1119
1114
|
error
|
|
1120
1115
|
});
|
|
1121
1116
|
}),
|
|
1122
|
-
notifyQueryResult(options$)
|
|
1117
|
+
notifyQueryResult(options$),
|
|
1118
|
+
registerResultInCache({ serializedKey, options, queryStore })
|
|
1123
1119
|
);
|
|
1124
1120
|
const newCache$ = queryStore.queryEvent$.pipe(
|
|
1125
1121
|
filter(
|
|
@@ -1307,11 +1303,9 @@ const createQueryListener = (store, onQuery) => store.store$.pipe(
|
|
|
1307
1303
|
);
|
|
1308
1304
|
return merge(NEVER, of(key)).pipe(
|
|
1309
1305
|
tap(() => {
|
|
1310
|
-
console.log("QUERY", key, "in");
|
|
1311
1306
|
}),
|
|
1312
1307
|
onQuery,
|
|
1313
1308
|
finalize(() => {
|
|
1314
|
-
console.log("QUERY", key, "complete");
|
|
1315
1309
|
}),
|
|
1316
1310
|
takeUntil(deleted$)
|
|
1317
1311
|
);
|
|
@@ -1539,7 +1533,7 @@ const createClient = () => {
|
|
|
1539
1533
|
const serializedKey = serializeKey(key);
|
|
1540
1534
|
const internalRefetch$ = new Subject();
|
|
1541
1535
|
const fn$ = maybeFn$ ?? (maybeFn ? of(maybeFn) : NEVER);
|
|
1542
|
-
|
|
1536
|
+
Logger.log("query$()", serializedKey);
|
|
1543
1537
|
const runner$ = options$.pipe(map((options) => ({ options })));
|
|
1544
1538
|
let deleteRunner = () => {
|
|
1545
1539
|
};
|
|
@@ -1564,7 +1558,7 @@ const createClient = () => {
|
|
|
1564
1558
|
}),
|
|
1565
1559
|
map(([value, deleteRunnerFn]) => {
|
|
1566
1560
|
deleteRunner = deleteRunnerFn;
|
|
1567
|
-
|
|
1561
|
+
Logger.log("reactjrx", serializedKey, "query trigger", {
|
|
1568
1562
|
trigger: value.trigger,
|
|
1569
1563
|
options: value.options
|
|
1570
1564
|
});
|
|
@@ -1602,9 +1596,6 @@ const createClient = () => {
|
|
|
1602
1596
|
return !shouldStop;
|
|
1603
1597
|
}, true),
|
|
1604
1598
|
map(([result]) => result),
|
|
1605
|
-
tap((result) => {
|
|
1606
|
-
console.log("result", result);
|
|
1607
|
-
}),
|
|
1608
1599
|
finalize(() => {
|
|
1609
1600
|
deleteRunner();
|
|
1610
1601
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MonoTypeOperatorFunction } from "rxjs";
|
|
2
2
|
import { type QueryStore } from "../store/createQueryStore";
|
|
3
|
-
import { type QueryOptions } from "../types";
|
|
3
|
+
import { type QueryResult, type QueryOptions } from "../types";
|
|
4
4
|
export declare const registerResultInCache: <T>({ queryStore, serializedKey, options }: {
|
|
5
5
|
queryStore: QueryStore;
|
|
6
6
|
serializedKey: string;
|
|
7
7
|
options: QueryOptions<T>;
|
|
8
|
-
}) => MonoTypeOperatorFunction<T
|
|
8
|
+
}) => MonoTypeOperatorFunction<Partial<QueryResult<T>>>;
|
package/package.json
CHANGED