@refinedev/core 4.5.6 → 4.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinedev/core",
3
- "version": "4.5.6",
3
+ "version": "4.5.7",
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",
@@ -1,5 +1,6 @@
1
1
  import React, { Dispatch, SetStateAction } from "react";
2
2
  import { QueryObserverResult, UseQueryOptions } from "@tanstack/react-query";
3
+ import warnOnce from "warn-once";
3
4
 
4
5
  import {
5
6
  useResourceWithRoute,
@@ -324,6 +325,15 @@ export const useForm = <
324
325
  const isEdit = action === "edit";
325
326
  const isClone = action === "clone";
326
327
 
328
+ warnOnce(
329
+ (isClone || isEdit) &&
330
+ Boolean(resourceFromProps) &&
331
+ !Boolean(idFromProps),
332
+ `[useForm]: action: "${action}", resource: "${resourceName}", id: ${id} \n\n` +
333
+ `If you don't use the \`setId\` method to set the \`id\`, you should pass the \`id\` prop to \`useForm\`. Otherwise, \`useForm\` will not be able to infer the \`id\` from the current URL. \n\n` +
334
+ `See https://refine.dev/docs/api-reference/core/hooks/useForm/#resource`,
335
+ );
336
+
327
337
  /**
328
338
  * Designated `redirect` route
329
339
  */
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from "react";
2
2
  import { QueryObserverResult, UseQueryOptions } from "@tanstack/react-query";
3
+ import warnOnce from "warn-once";
3
4
 
4
5
  import { useOne, useResourceWithRoute, useRouterContext } from "@hooks";
5
6
 
@@ -157,6 +158,13 @@ export const useShow = <
157
158
  }
158
159
  }
159
160
 
161
+ warnOnce(
162
+ Boolean(resourceFromProp) && !Boolean(id),
163
+ `[useShow]: resource: "${resourceName}", id: ${id} \n\n` +
164
+ `If you don't use the \`setShowId\` method to set the \`showId\`, you should pass the \`id\` prop to \`useShow\`. Otherwise, \`useShow\` will not be able to infer the \`id\` from the current URL. \n\n` +
165
+ `See https://refine.dev/docs/api-reference/core/hooks/show/useShow/#resource`,
166
+ );
167
+
160
168
  const queryResult = useOne<TData>({
161
169
  resource: resource?.name,
162
170
  id: showId ?? "",