@refinedev/core 5.0.6 → 5.0.8
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/CHANGELOG.md +32 -0
- package/dist/components/containers/refine/index.d.cts.map +1 -1
- package/dist/components/containers/refine/index.d.ts.map +1 -1
- package/dist/contexts/auth/index.d.cts.map +1 -1
- package/dist/contexts/auth/index.d.ts.map +1 -1
- package/dist/contexts/data/types.d.cts +1 -1
- package/dist/contexts/data/types.d.cts.map +1 -1
- package/dist/contexts/data/types.d.mts +1 -1
- package/dist/contexts/data/types.d.mts.map +1 -1
- package/dist/contexts/data/types.d.ts +1 -1
- package/dist/contexts/data/types.d.ts.map +1 -1
- package/dist/contexts/refine/index.d.cts.map +1 -1
- package/dist/contexts/refine/index.d.ts.map +1 -1
- package/dist/contexts/refine/types.d.cts +2 -0
- package/dist/contexts/refine/types.d.cts.map +1 -1
- package/dist/contexts/refine/types.d.mts +2 -0
- package/dist/contexts/refine/types.d.mts.map +2 -0
- package/dist/contexts/refine/types.d.ts +2 -0
- package/dist/contexts/refine/types.d.ts.map +1 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.cts +2 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.cts.map +1 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.mts +2 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.mts.map +2 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.ts +2 -1
- package/dist/definitions/helpers/handleRefineOptions/index.d.ts.map +1 -1
- package/dist/hooks/router/use-get-to-path/index.d.cts.map +1 -1
- package/dist/hooks/router/use-get-to-path/index.d.ts.map +1 -1
- package/dist/index.cjs +102 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/containers/refine/index.tsx +6 -1
- package/src/contexts/auth/index.tsx +4 -0
- package/src/contexts/data/types.ts +4 -0
- package/src/contexts/refine/index.tsx +1 -0
- package/src/contexts/refine/types.ts +2 -0
- package/src/definitions/helpers/handleRefineOptions/index.ts +6 -0
- package/src/hooks/router/use-get-to-path/index.ts +24 -5
- package/tasks.md +0 -354
package/dist/index.mjs
CHANGED
|
@@ -13,10 +13,12 @@ import {
|
|
|
13
13
|
|
|
14
14
|
// src/contexts/auth/index.tsx
|
|
15
15
|
import React from "react";
|
|
16
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
16
17
|
var AuthProviderContext = React.createContext(
|
|
17
18
|
{}
|
|
18
19
|
);
|
|
19
20
|
var AuthProviderContextProvider = /* @__PURE__ */ __name(({ children, isProvided, ...authProvider }) => {
|
|
21
|
+
const queryClient = useQueryClient();
|
|
20
22
|
const handleLogin = /* @__PURE__ */ __name(async (params) => {
|
|
21
23
|
var _a;
|
|
22
24
|
try {
|
|
@@ -47,6 +49,7 @@ var AuthProviderContextProvider = /* @__PURE__ */ __name(({ children, isProvided
|
|
|
47
49
|
var _a;
|
|
48
50
|
try {
|
|
49
51
|
const result = await ((_a = authProvider.logout) == null ? void 0 : _a.call(authProvider, params));
|
|
52
|
+
queryClient.invalidateQueries();
|
|
50
53
|
return result;
|
|
51
54
|
} catch (error) {
|
|
52
55
|
console.warn(
|
|
@@ -321,6 +324,7 @@ var defaultRefineOptions = {
|
|
|
321
324
|
singular: pluralize.singular
|
|
322
325
|
},
|
|
323
326
|
disableServerSideValidation: false,
|
|
327
|
+
disableRouteChangeHandler: false,
|
|
324
328
|
title: defaultTitle
|
|
325
329
|
};
|
|
326
330
|
var RefineContext = React2.createContext({
|
|
@@ -370,7 +374,8 @@ var handleRefineOptions = /* @__PURE__ */ __name(({
|
|
|
370
374
|
reactQueryDevtoolConfig,
|
|
371
375
|
syncWithLocation,
|
|
372
376
|
undoableTimeout,
|
|
373
|
-
warnWhenUnsavedChanges
|
|
377
|
+
warnWhenUnsavedChanges,
|
|
378
|
+
disableRouteChangeHandler
|
|
374
379
|
} = {}) => {
|
|
375
380
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
376
381
|
const optionsWithDefaults = {
|
|
@@ -396,7 +401,8 @@ var handleRefineOptions = /* @__PURE__ */ __name(({
|
|
|
396
401
|
title: {
|
|
397
402
|
icon: typeof ((_g = options == null ? void 0 : options.title) == null ? void 0 : _g.icon) === "undefined" ? defaultRefineOptions.title.icon : (_h = options == null ? void 0 : options.title) == null ? void 0 : _h.icon,
|
|
398
403
|
text: typeof ((_i = options == null ? void 0 : options.title) == null ? void 0 : _i.text) === "undefined" ? defaultRefineOptions.title.text : (_j = options == null ? void 0 : options.title) == null ? void 0 : _j.text
|
|
399
|
-
}
|
|
404
|
+
},
|
|
405
|
+
disableRouteChangeHandler: (options == null ? void 0 : options.disableRouteChangeHandler) ?? disableRouteChangeHandler ?? defaultRefineOptions.disableRouteChangeHandler
|
|
400
406
|
};
|
|
401
407
|
const disableTelemetryWithDefault = (options == null ? void 0 : options.disableTelemetry) ?? disableTelemetry ?? false;
|
|
402
408
|
const reactQueryWithDefaults = {
|
|
@@ -1126,9 +1132,9 @@ import {
|
|
|
1126
1132
|
} from "@tanstack/react-query";
|
|
1127
1133
|
|
|
1128
1134
|
// src/hooks/auth/useInvalidateAuthStore/index.ts
|
|
1129
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
1135
|
+
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
1130
1136
|
var useInvalidateAuthStore = /* @__PURE__ */ __name(() => {
|
|
1131
|
-
const queryClient =
|
|
1137
|
+
const queryClient = useQueryClient2();
|
|
1132
1138
|
const { keys: keys2 } = useKeys();
|
|
1133
1139
|
const invalidate = /* @__PURE__ */ __name(async () => {
|
|
1134
1140
|
await Promise.all(
|
|
@@ -2024,7 +2030,7 @@ See https://refine.dev/docs/data/hooks/use-many/#resource-`, "resourceWarningMes
|
|
|
2024
2030
|
import { getXRay as getXRay13 } from "@refinedev/devtools-internal";
|
|
2025
2031
|
import {
|
|
2026
2032
|
useMutation as useMutation7,
|
|
2027
|
-
useQueryClient as
|
|
2033
|
+
useQueryClient as useQueryClient3
|
|
2028
2034
|
} from "@tanstack/react-query";
|
|
2029
2035
|
|
|
2030
2036
|
// src/contexts/undoableQueue/types.ts
|
|
@@ -2055,7 +2061,7 @@ var useUpdate = /* @__PURE__ */ __name(({
|
|
|
2055
2061
|
const { resources, select } = useResourceParams({
|
|
2056
2062
|
resource: resourceFromProps
|
|
2057
2063
|
});
|
|
2058
|
-
const queryClient =
|
|
2064
|
+
const queryClient = useQueryClient3();
|
|
2059
2065
|
const dataProvider = useDataProvider();
|
|
2060
2066
|
const {
|
|
2061
2067
|
mutationMode: mutationModeContext,
|
|
@@ -2648,7 +2654,7 @@ var missingValuesError2 = new Error(
|
|
|
2648
2654
|
import { getXRay as getXRay15 } from "@refinedev/devtools-internal";
|
|
2649
2655
|
import {
|
|
2650
2656
|
useMutation as useMutation9,
|
|
2651
|
-
useQueryClient as
|
|
2657
|
+
useQueryClient as useQueryClient4
|
|
2652
2658
|
} from "@tanstack/react-query";
|
|
2653
2659
|
var useDelete = /* @__PURE__ */ __name(({
|
|
2654
2660
|
mutationOptions,
|
|
@@ -2657,7 +2663,7 @@ var useDelete = /* @__PURE__ */ __name(({
|
|
|
2657
2663
|
const { mutate: checkError } = useOnError();
|
|
2658
2664
|
const dataProvider = useDataProvider();
|
|
2659
2665
|
const { resources, select } = useResourceParams();
|
|
2660
|
-
const queryClient =
|
|
2666
|
+
const queryClient = useQueryClient4();
|
|
2661
2667
|
const {
|
|
2662
2668
|
mutationMode: mutationModeContext,
|
|
2663
2669
|
undoableTimeout: undoableTimeoutContext
|
|
@@ -3133,7 +3139,7 @@ var missingValuesError3 = new Error(
|
|
|
3133
3139
|
import { getXRay as getXRay17 } from "@refinedev/devtools-internal";
|
|
3134
3140
|
import {
|
|
3135
3141
|
useMutation as useMutation11,
|
|
3136
|
-
useQueryClient as
|
|
3142
|
+
useQueryClient as useQueryClient5
|
|
3137
3143
|
} from "@tanstack/react-query";
|
|
3138
3144
|
var useUpdateMany = /* @__PURE__ */ __name(({
|
|
3139
3145
|
ids: idsFromProps,
|
|
@@ -3152,7 +3158,7 @@ var useUpdateMany = /* @__PURE__ */ __name(({
|
|
|
3152
3158
|
overtimeOptions
|
|
3153
3159
|
} = {}) => {
|
|
3154
3160
|
const { resources, select } = useResourceParams();
|
|
3155
|
-
const queryClient =
|
|
3161
|
+
const queryClient = useQueryClient5();
|
|
3156
3162
|
const dataProvider = useDataProvider();
|
|
3157
3163
|
const translate = useTranslate();
|
|
3158
3164
|
const {
|
|
@@ -3569,7 +3575,7 @@ var missingValuesError4 = new Error(
|
|
|
3569
3575
|
import { getXRay as getXRay18 } from "@refinedev/devtools-internal";
|
|
3570
3576
|
import {
|
|
3571
3577
|
useMutation as useMutation12,
|
|
3572
|
-
useQueryClient as
|
|
3578
|
+
useQueryClient as useQueryClient6
|
|
3573
3579
|
} from "@tanstack/react-query";
|
|
3574
3580
|
var useDeleteMany = /* @__PURE__ */ __name(({
|
|
3575
3581
|
mutationOptions,
|
|
@@ -3588,7 +3594,7 @@ var useDeleteMany = /* @__PURE__ */ __name(({
|
|
|
3588
3594
|
const invalidateStore = useInvalidate();
|
|
3589
3595
|
const { log } = useLog();
|
|
3590
3596
|
const { resources, select } = useResourceParams();
|
|
3591
|
-
const queryClient =
|
|
3597
|
+
const queryClient = useQueryClient6();
|
|
3592
3598
|
const getMeta = useMeta();
|
|
3593
3599
|
const {
|
|
3594
3600
|
options: { textTransformers }
|
|
@@ -4322,11 +4328,11 @@ var LiveContextProvider = /* @__PURE__ */ __name(({
|
|
|
4322
4328
|
// src/hooks/invalidate/index.tsx
|
|
4323
4329
|
import { useCallback as useCallback2 } from "react";
|
|
4324
4330
|
import {
|
|
4325
|
-
useQueryClient as
|
|
4331
|
+
useQueryClient as useQueryClient7
|
|
4326
4332
|
} from "@tanstack/react-query";
|
|
4327
4333
|
var useInvalidate = /* @__PURE__ */ __name(() => {
|
|
4328
4334
|
const { resources } = useResourceParams();
|
|
4329
|
-
const queryClient =
|
|
4335
|
+
const queryClient = useQueryClient7();
|
|
4330
4336
|
const { keys: keys2 } = useKeys();
|
|
4331
4337
|
const invalidate = useCallback2(
|
|
4332
4338
|
async ({
|
|
@@ -5200,6 +5206,7 @@ __name(useResourceParams, "useResourceParams");
|
|
|
5200
5206
|
|
|
5201
5207
|
// src/hooks/router/use-get-to-path/index.ts
|
|
5202
5208
|
import React16 from "react";
|
|
5209
|
+
import warnOnce4 from "warn-once";
|
|
5203
5210
|
var useGetToPath = /* @__PURE__ */ __name(() => {
|
|
5204
5211
|
const { resource: resourceFromRoute, resources } = useResourceParams();
|
|
5205
5212
|
const parsed = useParsed();
|
|
@@ -5210,19 +5217,31 @@ var useGetToPath = /* @__PURE__ */ __name(() => {
|
|
|
5210
5217
|
if (!selectedResource) {
|
|
5211
5218
|
return void 0;
|
|
5212
5219
|
}
|
|
5213
|
-
const
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5220
|
+
const fullResource = resources.find((r) => {
|
|
5221
|
+
if (!r.identifier)
|
|
5222
|
+
return false;
|
|
5223
|
+
if (!selectedResource.identifier)
|
|
5224
|
+
return false;
|
|
5225
|
+
return r.identifier === selectedResource.identifier;
|
|
5226
|
+
}) ?? resources.find((r) => {
|
|
5227
|
+
if (!r.identifier)
|
|
5228
|
+
return false;
|
|
5229
|
+
return r.identifier === selectedResource.name;
|
|
5230
|
+
}) ?? resources.find((r) => r.name === selectedResource.name) ?? selectedResource;
|
|
5231
|
+
const actionRoutes = getActionRoutesFromResource(fullResource, resources);
|
|
5217
5232
|
const actionRoute = (_a = actionRoutes.find(
|
|
5218
5233
|
(item) => item.action === action
|
|
5219
5234
|
)) == null ? void 0 : _a.route;
|
|
5220
5235
|
if (!actionRoute) {
|
|
5236
|
+
warnOnce4(
|
|
5237
|
+
true,
|
|
5238
|
+
`[useGetToPath]: Could not find a route for the "${action}" action of the "${selectedResource.name}" resource. Please make sure that the resource has the "${action}" property defined.`
|
|
5239
|
+
);
|
|
5221
5240
|
return void 0;
|
|
5222
5241
|
}
|
|
5223
5242
|
const composed = composeRoute(
|
|
5224
5243
|
actionRoute,
|
|
5225
|
-
|
|
5244
|
+
fullResource == null ? void 0 : fullResource.meta,
|
|
5226
5245
|
parsed,
|
|
5227
5246
|
meta
|
|
5228
5247
|
);
|
|
@@ -5414,7 +5433,7 @@ var useNavigation2 = /* @__PURE__ */ __name(() => {
|
|
|
5414
5433
|
}, "useNavigation");
|
|
5415
5434
|
|
|
5416
5435
|
// src/hooks/show/index.ts
|
|
5417
|
-
import
|
|
5436
|
+
import warnOnce5 from "warn-once";
|
|
5418
5437
|
var useShow = /* @__PURE__ */ __name(({
|
|
5419
5438
|
resource: resourceFromProp,
|
|
5420
5439
|
id,
|
|
@@ -5437,7 +5456,7 @@ var useShow = /* @__PURE__ */ __name(({
|
|
|
5437
5456
|
resource,
|
|
5438
5457
|
meta
|
|
5439
5458
|
});
|
|
5440
|
-
|
|
5459
|
+
warnOnce5(
|
|
5441
5460
|
Boolean(resourceFromProp) && !showId,
|
|
5442
5461
|
idWarningMessage2(identifier, showId)
|
|
5443
5462
|
);
|
|
@@ -5668,7 +5687,7 @@ var useToPath = /* @__PURE__ */ __name(({
|
|
|
5668
5687
|
|
|
5669
5688
|
// src/components/link/index.tsx
|
|
5670
5689
|
import React19, { forwardRef, useContext as useContext20 } from "react";
|
|
5671
|
-
import
|
|
5690
|
+
import warnOnce6 from "warn-once";
|
|
5672
5691
|
var LinkComponent = /* @__PURE__ */ __name((props, ref) => {
|
|
5673
5692
|
const routerContext = useContext20(RouterContext);
|
|
5674
5693
|
const LinkFromContext = routerContext == null ? void 0 : routerContext.Link;
|
|
@@ -5676,7 +5695,7 @@ var LinkComponent = /* @__PURE__ */ __name((props, ref) => {
|
|
|
5676
5695
|
let resolvedTo = "";
|
|
5677
5696
|
if ("go" in props) {
|
|
5678
5697
|
if (!(routerContext == null ? void 0 : routerContext.go)) {
|
|
5679
|
-
|
|
5698
|
+
warnOnce6(
|
|
5680
5699
|
true,
|
|
5681
5700
|
"[Link]: `routerProvider` is not found. To use `go`, Please make sure that you have provided the `routerProvider` for `<Refine />` https://refine.dev/docs/routing/router-provider/ \n"
|
|
5682
5701
|
);
|
|
@@ -6023,7 +6042,7 @@ var useSelect = /* @__PURE__ */ __name((props) => {
|
|
|
6023
6042
|
import React22, { useState as useState8, useEffect as useEffect12, useCallback as useCallback10 } from "react";
|
|
6024
6043
|
import differenceWith2 from "lodash-es/differenceWith.js";
|
|
6025
6044
|
import isEqual3 from "lodash-es/isEqual.js";
|
|
6026
|
-
import
|
|
6045
|
+
import warnOnce7 from "warn-once";
|
|
6027
6046
|
var defaultPermanentFilter = [];
|
|
6028
6047
|
var defaultPermanentSorter = [];
|
|
6029
6048
|
var EMPTY_ARRAY3 = Object.freeze([]);
|
|
@@ -6085,7 +6104,7 @@ function useTable({
|
|
|
6085
6104
|
meta: preferredMeta
|
|
6086
6105
|
});
|
|
6087
6106
|
React22.useEffect(() => {
|
|
6088
|
-
|
|
6107
|
+
warnOnce7(
|
|
6089
6108
|
typeof identifier === "undefined",
|
|
6090
6109
|
"useTable: `resource` is not defined."
|
|
6091
6110
|
);
|
|
@@ -6232,7 +6251,7 @@ import { useContext as useContext22 } from "react";
|
|
|
6232
6251
|
import { getXRay as getXRay23 } from "@refinedev/devtools-internal";
|
|
6233
6252
|
import {
|
|
6234
6253
|
useMutation as useMutation14,
|
|
6235
|
-
useQueryClient as
|
|
6254
|
+
useQueryClient as useQueryClient8
|
|
6236
6255
|
} from "@tanstack/react-query";
|
|
6237
6256
|
|
|
6238
6257
|
// src/contexts/auditLog/index.tsx
|
|
@@ -6247,7 +6266,7 @@ var useLog = /* @__PURE__ */ __name(({
|
|
|
6247
6266
|
logMutationOptions,
|
|
6248
6267
|
renameMutationOptions
|
|
6249
6268
|
} = {}) => {
|
|
6250
|
-
const queryClient =
|
|
6269
|
+
const queryClient = useQueryClient8();
|
|
6251
6270
|
const auditLogContext = useContext22(AuditLogContext);
|
|
6252
6271
|
const { keys: keys2 } = useKeys();
|
|
6253
6272
|
const { resources } = useContext22(ResourceContext);
|
|
@@ -6344,7 +6363,7 @@ var useLogList = /* @__PURE__ */ __name(({
|
|
|
6344
6363
|
|
|
6345
6364
|
// src/hooks/breadcrumb/index.ts
|
|
6346
6365
|
import { useContext as useContext24 } from "react";
|
|
6347
|
-
import
|
|
6366
|
+
import warnOnce8 from "warn-once";
|
|
6348
6367
|
var useBreadcrumb = /* @__PURE__ */ __name(({
|
|
6349
6368
|
meta: metaFromProps = {}
|
|
6350
6369
|
} = {}) => {
|
|
@@ -6390,7 +6409,7 @@ var useBreadcrumb = /* @__PURE__ */ __name(({
|
|
|
6390
6409
|
const key = `actions.${action}`;
|
|
6391
6410
|
const actionLabel = translate(key);
|
|
6392
6411
|
if (typeof i18nProvider !== "undefined" && actionLabel === key) {
|
|
6393
|
-
|
|
6412
|
+
warnOnce8(
|
|
6394
6413
|
true,
|
|
6395
6414
|
`[useBreadcrumb]: Breadcrumb missing translate key for the "${action}" action. Please add "actions.${action}" key to your translation file.
|
|
6396
6415
|
For more information, see https://refine.dev/docs/api-reference/core/hooks/useBreadcrumb/#i18n-support`
|
|
@@ -6786,11 +6805,11 @@ function useDeleteButton(props) {
|
|
|
6786
6805
|
__name(useDeleteButton, "useDeleteButton");
|
|
6787
6806
|
|
|
6788
6807
|
// src/hooks/button/refresh-button/index.tsx
|
|
6789
|
-
import { useQueryClient as
|
|
6808
|
+
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
6790
6809
|
function useRefreshButton(props) {
|
|
6791
6810
|
const translate = useTranslate();
|
|
6792
6811
|
const { keys: keys2 } = useKeys();
|
|
6793
|
-
const queryClient =
|
|
6812
|
+
const queryClient = useQueryClient9();
|
|
6794
6813
|
const invalidates = useInvalidate();
|
|
6795
6814
|
const { identifier, id, resources } = useResourceParams({
|
|
6796
6815
|
resource: props.resource,
|
|
@@ -8087,7 +8106,7 @@ import React39 from "react";
|
|
|
8087
8106
|
|
|
8088
8107
|
// src/hooks/useTelemetryData/index.ts
|
|
8089
8108
|
import { useContext as useContext26 } from "react";
|
|
8090
|
-
var REFINE_VERSION = "5.0.
|
|
8109
|
+
var REFINE_VERSION = "5.0.8";
|
|
8091
8110
|
var useTelemetryData = /* @__PURE__ */ __name(() => {
|
|
8092
8111
|
var _a;
|
|
8093
8112
|
const auth = useIsExistAuthentication();
|
|
@@ -8226,6 +8245,7 @@ var Refine = /* @__PURE__ */ __name(({
|
|
|
8226
8245
|
} = handleRefineOptions({
|
|
8227
8246
|
options
|
|
8228
8247
|
});
|
|
8248
|
+
const disableRouteChangeHandler = optionsWithDefaults.disableRouteChangeHandler;
|
|
8229
8249
|
const queryClient = useDeepMemo(() => {
|
|
8230
8250
|
var _a;
|
|
8231
8251
|
if (reactQueryWithDefaults.clientConfig instanceof QueryClient) {
|
|
@@ -8271,7 +8291,7 @@ var Refine = /* @__PURE__ */ __name(({
|
|
|
8271
8291
|
onLiveEvent,
|
|
8272
8292
|
options: optionsWithDefaults
|
|
8273
8293
|
},
|
|
8274
|
-
/* @__PURE__ */ React41.createElement(UnsavedWarnContextProvider, null, /* @__PURE__ */ React41.createElement(React41.Fragment, null, children, !disableTelemetryWithDefault && /* @__PURE__ */ React41.createElement(Telemetry, null), /* @__PURE__ */ React41.createElement(RouteChangeHandler, null)))
|
|
8294
|
+
/* @__PURE__ */ React41.createElement(UnsavedWarnContextProvider, null, /* @__PURE__ */ React41.createElement(React41.Fragment, null, children, !disableTelemetryWithDefault && /* @__PURE__ */ React41.createElement(Telemetry, null), !disableRouteChangeHandler && /* @__PURE__ */ React41.createElement(RouteChangeHandler, null)))
|
|
8275
8295
|
)))
|
|
8276
8296
|
))))))
|
|
8277
8297
|
)));
|