@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.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: getQueryKeys(...tuple),
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 ?? {};
@@ -495,8 +507,14 @@ function createRouteClient(opts) {
495
507
  };
496
508
  const useEndpoint = (...useArgs) => {
497
509
  const args = useArgs[0];
498
- emit({ type: "useEndpoint", leaf: leafLabel, variant: "mutation" });
499
510
  const tuple = toArgsTuple(args);
511
+ const mutationKey = getQueryKeys(...tuple);
512
+ emit({
513
+ type: "useEndpoint",
514
+ leaf: leafLabel,
515
+ variant: "mutation",
516
+ keys: mutationKey
517
+ });
500
518
  const listenersRef = useRef(/* @__PURE__ */ new Set());
501
519
  const notifyListeners = useCallback((data) => {
502
520
  listenersRef.current.forEach((listener) => listener(data));
@@ -513,7 +531,7 @@ function createRouteClient(opts) {
513
531
  const mutationResult = useMutation(
514
532
  {
515
533
  ...mutationBuildOptions,
516
- mutationKey: getQueryKeys(...tuple),
534
+ mutationKey,
517
535
  mutationFn: async (body) => {
518
536
  const result = await fetchMutation(
519
537
  ...[...tuple, body]