@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.mjs
CHANGED
|
@@ -378,8 +378,14 @@ function createRouteClient(opts) {
|
|
|
378
378
|
if (isGet && isFeed) {
|
|
379
379
|
const useEndpoint2 = (...useArgs) => {
|
|
380
380
|
const args = useArgs[0];
|
|
381
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "infiniteGet" });
|
|
382
381
|
const tuple = toArgsTuple(args);
|
|
382
|
+
const queryKeys = getQueryKeys(...tuple);
|
|
383
|
+
emit({
|
|
384
|
+
type: "useEndpoint",
|
|
385
|
+
leaf: leafLabel,
|
|
386
|
+
variant: "infiniteGet",
|
|
387
|
+
keys: queryKeys
|
|
388
|
+
});
|
|
383
389
|
const params = args?.params;
|
|
384
390
|
const query = args?.query;
|
|
385
391
|
const buildOptions = rqOpts ?? {};
|
|
@@ -406,7 +412,7 @@ function createRouteClient(opts) {
|
|
|
406
412
|
const queryResult = useInfiniteQuery(
|
|
407
413
|
{
|
|
408
414
|
...buildOptions,
|
|
409
|
-
queryKey:
|
|
415
|
+
queryKey: queryKeys,
|
|
410
416
|
initialPageParam: void 0,
|
|
411
417
|
getNextPageParam: (lastPage) => getNextCursor(lastPage),
|
|
412
418
|
placeholderData: keepPreviousData,
|
|
@@ -437,8 +443,14 @@ function createRouteClient(opts) {
|
|
|
437
443
|
if (isGet) {
|
|
438
444
|
const useEndpoint2 = (...useArgs) => {
|
|
439
445
|
const args = useArgs[0];
|
|
440
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "get" });
|
|
441
446
|
const tuple = toArgsTuple(args);
|
|
447
|
+
const queryKeys = getQueryKeys(...tuple);
|
|
448
|
+
emit({
|
|
449
|
+
type: "useEndpoint",
|
|
450
|
+
leaf: leafLabel,
|
|
451
|
+
variant: "get",
|
|
452
|
+
keys: queryKeys
|
|
453
|
+
});
|
|
442
454
|
const params = args?.params;
|
|
443
455
|
const query = args?.query;
|
|
444
456
|
const buildOptions = rqOpts ?? {};
|
|
@@ -456,7 +468,6 @@ function createRouteClient(opts) {
|
|
|
456
468
|
},
|
|
457
469
|
[]
|
|
458
470
|
);
|
|
459
|
-
buildUrl({ ...leaf, cfg: leafCfg }, baseUrl, params, query);
|
|
460
471
|
const queryResult = useQuery(
|
|
461
472
|
{
|
|
462
473
|
...buildOptions,
|
|
@@ -495,8 +506,14 @@ function createRouteClient(opts) {
|
|
|
495
506
|
};
|
|
496
507
|
const useEndpoint = (...useArgs) => {
|
|
497
508
|
const args = useArgs[0];
|
|
498
|
-
emit({ type: "useEndpoint", leaf: leafLabel, variant: "mutation" });
|
|
499
509
|
const tuple = toArgsTuple(args);
|
|
510
|
+
const mutationKey = getQueryKeys(...tuple);
|
|
511
|
+
emit({
|
|
512
|
+
type: "useEndpoint",
|
|
513
|
+
leaf: leafLabel,
|
|
514
|
+
variant: "mutation",
|
|
515
|
+
keys: mutationKey
|
|
516
|
+
});
|
|
500
517
|
const listenersRef = useRef(/* @__PURE__ */ new Set());
|
|
501
518
|
const notifyListeners = useCallback((data) => {
|
|
502
519
|
listenersRef.current.forEach((listener) => listener(data));
|
|
@@ -513,7 +530,7 @@ function createRouteClient(opts) {
|
|
|
513
530
|
const mutationResult = useMutation(
|
|
514
531
|
{
|
|
515
532
|
...mutationBuildOptions,
|
|
516
|
-
mutationKey
|
|
533
|
+
mutationKey,
|
|
517
534
|
mutationFn: async (body) => {
|
|
518
535
|
const result = await fetchMutation(
|
|
519
536
|
...[...tuple, body]
|