@emeryld/rrroutes-client 2.3.9 → 2.3.10
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 +23 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +23 -5
- package/dist/index.mjs.map +1 -1
- package/dist/routesV3.client.types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -413,8 +413,14 @@ function createRouteClient(opts) {
|
|
|
413
413
|
if (isGet && isFeed) {
|
|
414
414
|
const useEndpoint2 = (...useArgs) => {
|
|
415
415
|
const args = useArgs[0];
|
|
416
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "infiniteGet" });
|
|
417
416
|
const tuple = toArgsTuple(args);
|
|
417
|
+
const queryKeys = getQueryKeys(...tuple);
|
|
418
|
+
emit({
|
|
419
|
+
type: "useEndpoint",
|
|
420
|
+
leaf: leafLabel,
|
|
421
|
+
variant: "infiniteGet",
|
|
422
|
+
keys: queryKeys
|
|
423
|
+
});
|
|
418
424
|
const params = args?.params;
|
|
419
425
|
const query = args?.query;
|
|
420
426
|
const buildOptions = rqOpts ?? {};
|
|
@@ -441,7 +447,7 @@ function createRouteClient(opts) {
|
|
|
441
447
|
const queryResult = (0, import_react_query.useInfiniteQuery)(
|
|
442
448
|
{
|
|
443
449
|
...buildOptions,
|
|
444
|
-
queryKey:
|
|
450
|
+
queryKey: queryKeys,
|
|
445
451
|
initialPageParam: void 0,
|
|
446
452
|
getNextPageParam: (lastPage) => getNextCursor(lastPage),
|
|
447
453
|
placeholderData: import_react_query.keepPreviousData,
|
|
@@ -472,8 +478,14 @@ function createRouteClient(opts) {
|
|
|
472
478
|
if (isGet) {
|
|
473
479
|
const useEndpoint2 = (...useArgs) => {
|
|
474
480
|
const args = useArgs[0];
|
|
475
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "get" });
|
|
476
481
|
const tuple = toArgsTuple(args);
|
|
482
|
+
const queryKeys = getQueryKeys(...tuple);
|
|
483
|
+
emit({
|
|
484
|
+
type: "useEndpoint",
|
|
485
|
+
leaf: leafLabel,
|
|
486
|
+
variant: "get",
|
|
487
|
+
keys: queryKeys
|
|
488
|
+
});
|
|
477
489
|
const params = args?.params;
|
|
478
490
|
const query = args?.query;
|
|
479
491
|
const buildOptions = rqOpts ?? {};
|
|
@@ -530,8 +542,14 @@ function createRouteClient(opts) {
|
|
|
530
542
|
};
|
|
531
543
|
const useEndpoint = (...useArgs) => {
|
|
532
544
|
const args = useArgs[0];
|
|
533
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "mutation" });
|
|
534
545
|
const tuple = toArgsTuple(args);
|
|
546
|
+
const mutationKey = getQueryKeys(...tuple);
|
|
547
|
+
emit({
|
|
548
|
+
type: "useEndpoint",
|
|
549
|
+
leaf: leafLabel,
|
|
550
|
+
variant: "mutation",
|
|
551
|
+
keys: mutationKey
|
|
552
|
+
});
|
|
535
553
|
const listenersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
536
554
|
const notifyListeners = (0, import_react.useCallback)((data) => {
|
|
537
555
|
listenersRef.current.forEach((listener) => listener(data));
|
|
@@ -548,7 +566,7 @@ function createRouteClient(opts) {
|
|
|
548
566
|
const mutationResult = (0, import_react_query.useMutation)(
|
|
549
567
|
{
|
|
550
568
|
...mutationBuildOptions,
|
|
551
|
-
mutationKey
|
|
569
|
+
mutationKey,
|
|
552
570
|
mutationFn: async (body) => {
|
|
553
571
|
const result = await fetchMutation(
|
|
554
572
|
...[...tuple, body]
|