@hexdspace/react 0.0.5 → 0.0.7

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.d.ts CHANGED
@@ -91,6 +91,6 @@ type ResponsiveMutation<Args, Res> = {
91
91
  onSuccess?: (data: Res) => void;
92
92
  };
93
93
 
94
- declare function useResponsiveMutation<Args, Res>(responsiveMutation: ResponsiveMutation<Args, Res>): _tanstack_react_query.UseMutationResult<UIOk<Res>, UIFail, Args, OptimisticSnapshot | undefined>;
94
+ declare function useResponsiveMutation<Args, Res>(responsiveMutation: ResponsiveMutation<Args, Res>, queryClient: QueryClient): _tanstack_react_query.UseMutationResult<UIOk<Res>, UIFail, Args, OptimisticSnapshot | undefined>;
95
95
 
96
96
  export { type CacheInstruction, type CustomInstruction, DEFAULT_NOTIFICATION_CHANNEL, type Instruction, type InstructionContext, type Notification, type NotificationAction, NotificationHost, type NotificationInstruction, type NotificationVariant, NotifierController, NotifierProvider, type OptimisticSnapshot, type ResponsiveMutation, type UIFail, type UIOk, type UIResult, notifierController, ui, useNotifierController, useResponsiveMutation };
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var ui = {
25
25
  };
26
26
 
27
27
  // src/util/responsive-query/use-responsive-mutation.ts
28
- import { useMutation, useQueryClient } from "@tanstack/react-query";
28
+ import { useMutation } from "@tanstack/react-query";
29
29
 
30
30
  // src/feature/notifier/entity/notification-bus.ts
31
31
  var NotificationBus = class {
@@ -238,9 +238,8 @@ var ToastContent = ({ notification }) => {
238
238
  };
239
239
 
240
240
  // src/util/responsive-query/use-responsive-mutation.ts
241
- function useResponsiveMutation(responsiveMutation) {
241
+ function useResponsiveMutation(responsiveMutation, queryClient) {
242
242
  const { mutationFn, optimistic, onSuccess } = responsiveMutation;
243
- const qc = useQueryClient();
244
243
  return useMutation({
245
244
  mutationFn: async (args) => {
246
245
  const res = await mutationFn(args);
@@ -249,15 +248,15 @@ function useResponsiveMutation(responsiveMutation) {
249
248
  },
250
249
  onMutate: async (args) => {
251
250
  if (!optimistic) return void 0;
252
- const snapshot = await optimistic(args, { queryClient: qc });
251
+ const snapshot = await optimistic(args, { queryClient });
253
252
  return snapshot ?? void 0;
254
253
  },
255
254
  onError: (err, _args, ctx) => {
256
255
  if (ctx) void ctx.rollback();
257
- executeEffects(err.effects, { queryClient: qc });
256
+ executeEffects(err.effects, { queryClient });
258
257
  },
259
258
  onSuccess: (res) => {
260
- executeEffects(res.effects, { queryClient: qc });
259
+ executeEffects(res.effects, { queryClient });
261
260
  onSuccess?.(res.value);
262
261
  }
263
262
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -18,12 +18,17 @@
18
18
  "dependencies": {
19
19
  "@tanstack/react-query": "^5.90.11",
20
20
  "lucide-react": "^0.555.0",
21
- "react": "^19.2.0",
22
21
  "react-toastify": "^11.0.5",
23
22
  "uuid": "^13.0.0",
24
23
  "@hexdspace/util": "0.0.1"
25
24
  },
25
+ "peerDependencies": {
26
+ "@tanstack/react-query": "^5.90.11",
27
+ "react": "^19.2.0"
28
+ },
26
29
  "devDependencies": {
30
+ "@tanstack/react-query": "^5.90.11",
31
+ "react": "^19.2.0",
27
32
  "@types/react": "^19.2.7"
28
33
  },
29
34
  "scripts": {