@refinedev/core 4.28.2 → 4.30.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinedev/core",
3
- "version": "4.28.2",
3
+ "version": "4.30.0",
4
4
  "description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -48,7 +48,6 @@
48
48
  "papaparse": "^5.3.0",
49
49
  "pluralize": "^8.0.0",
50
50
  "qs": "^6.10.1",
51
- "@tanstack/react-query-devtools": "^4.10.1",
52
51
  "@tanstack/react-query": "^4.10.1",
53
52
  "tslib": "^2.3.1",
54
53
  "warn-once": "^0.1.0"
@@ -1,5 +1,4 @@
1
1
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
- import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
3
2
  import React from "react";
4
3
 
5
4
  import { ReadyPage as DefaultReadyPage, RouteChangeHandler } from "@components";
@@ -420,13 +419,6 @@ Interested in any of the new backend features of refine? Join now and get early
420
419
  </AuthBindingsContextProvider>
421
420
  </LegacyAuthContextProvider>
422
421
  </NotificationContextProvider>
423
- {reactQueryWithDefaults.devtoolConfig === false ? null : (
424
- <ReactQueryDevtools
425
- initialIsOpen={false}
426
- position="bottom-right"
427
- {...reactQueryWithDefaults.devtoolConfig}
428
- />
429
- )}
430
422
  </QueryClientProvider>
431
423
  );
432
424
  };
@@ -1,31 +1,57 @@
1
- import { useEffect } from "react";
1
+ import React from "react";
2
2
 
3
3
  import { useTelemetryData } from "@hooks/useTelemetryData";
4
4
 
5
5
  import { ITelemetryData } from "../../interfaces/telemetry";
6
6
 
7
- const encode = (payload: ITelemetryData): string => {
8
- const stringifyedPayload = JSON.stringify(payload || {});
7
+ const encode = (payload: ITelemetryData): string | undefined => {
8
+ try {
9
+ const stringifiedPayload = JSON.stringify(payload || {});
9
10
 
10
- if (typeof btoa !== "undefined") {
11
- return btoa(stringifyedPayload);
11
+ if (typeof btoa !== "undefined") {
12
+ return btoa(stringifiedPayload);
13
+ }
14
+
15
+ return Buffer.from(stringifiedPayload).toString("base64");
16
+ } catch (err) {
17
+ return undefined;
12
18
  }
19
+ };
20
+
21
+ const throughImage = (src: string) => {
22
+ const img = new Image();
23
+
24
+ img.src = src;
25
+ };
13
26
 
14
- return Buffer.from(stringifyedPayload).toString("base64");
27
+ const throughFetch = (src: string) => {
28
+ fetch(src);
29
+ };
30
+
31
+ const transport = (src: string) => {
32
+ if (typeof Image !== "undefined") {
33
+ throughImage(src);
34
+ } else if (typeof fetch !== "undefined") {
35
+ throughFetch(src);
36
+ }
15
37
  };
16
38
 
17
39
  export const Telemetry: React.FC<{}> = () => {
18
40
  const payload = useTelemetryData();
41
+ const sent = React.useRef(false);
42
+
43
+ React.useEffect(() => {
44
+ if (sent.current) {
45
+ return;
46
+ }
47
+ const encoded = encode(payload);
19
48
 
20
- useEffect(() => {
21
- if (typeof window === "undefined" && !Image) {
49
+ if (!encoded) {
22
50
  return;
23
51
  }
24
52
 
25
- const img = new Image();
26
- img.src = `https://telemetry.refine.dev/telemetry?payload=${encode(
27
- payload,
28
- )}`;
53
+ transport(`https://telemetry.refine.dev/telemetry?payload=${encoded}`);
54
+ sent.current = true;
29
55
  }, []);
30
56
 
31
57
  return null;
@@ -1,7 +1,6 @@
1
1
  import { RefineProps } from "@components/containers";
2
2
  import React, { ReactNode } from "react";
3
3
  import { QueryClientConfig, QueryClient } from "@tanstack/react-query";
4
- import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
5
4
 
6
5
  import {
7
6
  MutationMode,
@@ -28,7 +27,10 @@ export interface IRefineOptions {
28
27
  };
29
28
  reactQuery?: {
30
29
  clientConfig?: QueryClientConfig | InstanceType<typeof QueryClient>;
31
- devtoolConfig?: React.ComponentProps<typeof ReactQueryDevtools> | false;
30
+ /**
31
+ * @deprecated `@tanstack/react-query`'s devtools are removed from the core. Please use the `@tanstack/react-query-devtools` package manually in your project. This option will be removed in the next major version and has no effect on the `@tanstack/react-query-devtools` package usage.
32
+ */
33
+ devtoolConfig?: any | false;
32
34
  };
33
35
  overtime?: UseLoadingOvertimeRefineContext;
34
36
  textTransformers?: TextTransformers;
@@ -1,5 +1,4 @@
1
1
  import { QueryClient, QueryClientConfig } from "@tanstack/react-query";
2
- import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
3
2
 
4
3
  import { defaultRefineOptions } from "@contexts/refine";
5
4
  import {
@@ -18,9 +17,7 @@ type HandleRefineOptionsProps = {
18
17
  liveMode?: LiveModeProps["liveMode"];
19
18
  disableTelemetry?: boolean;
20
19
  reactQueryClientConfig?: QueryClientConfig;
21
- reactQueryDevtoolConfig?:
22
- | React.ComponentProps<typeof ReactQueryDevtools>
23
- | false;
20
+ reactQueryDevtoolConfig?: any | false;
24
21
  };
25
22
 
26
23
  type HandleRefineOptionsReturnValues = {
@@ -28,7 +25,7 @@ type HandleRefineOptionsReturnValues = {
28
25
  disableTelemetryWithDefault: boolean;
29
26
  reactQueryWithDefaults: {
30
27
  clientConfig: QueryClientConfig | InstanceType<typeof QueryClient>;
31
- devtoolConfig: false | React.ComponentProps<typeof ReactQueryDevtools>;
28
+ devtoolConfig: false | any;
32
29
  };
33
30
  };
34
31