@emeryld/rrroutes-client 2.3.9 → 2.3.11
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 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +23 -6
- package/dist/index.mjs.map +1 -1
- package/dist/routesV3.client.types.d.ts +3 -4
- package/package.json +2 -2
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 ?? {};
|
|
@@ -491,7 +503,6 @@ function createRouteClient(opts) {
|
|
|
491
503
|
},
|
|
492
504
|
[]
|
|
493
505
|
);
|
|
494
|
-
buildUrl({ ...leaf, cfg: leafCfg }, baseUrl, params, query);
|
|
495
506
|
const queryResult = (0, import_react_query.useQuery)(
|
|
496
507
|
{
|
|
497
508
|
...buildOptions,
|
|
@@ -530,8 +541,14 @@ function createRouteClient(opts) {
|
|
|
530
541
|
};
|
|
531
542
|
const useEndpoint = (...useArgs) => {
|
|
532
543
|
const args = useArgs[0];
|
|
533
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "mutation" });
|
|
534
544
|
const tuple = toArgsTuple(args);
|
|
545
|
+
const mutationKey = getQueryKeys(...tuple);
|
|
546
|
+
emit({
|
|
547
|
+
type: "useEndpoint",
|
|
548
|
+
leaf: leafLabel,
|
|
549
|
+
variant: "mutation",
|
|
550
|
+
keys: mutationKey
|
|
551
|
+
});
|
|
535
552
|
const listenersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
536
553
|
const notifyListeners = (0, import_react.useCallback)((data) => {
|
|
537
554
|
listenersRef.current.forEach((listener) => listener(data));
|
|
@@ -548,7 +565,7 @@ function createRouteClient(opts) {
|
|
|
548
565
|
const mutationResult = (0, import_react_query.useMutation)(
|
|
549
566
|
{
|
|
550
567
|
...mutationBuildOptions,
|
|
551
|
-
mutationKey
|
|
568
|
+
mutationKey,
|
|
552
569
|
mutationFn: async (body) => {
|
|
553
570
|
const result = await fetchMutation(
|
|
554
571
|
...[...tuple, body]
|