@refinedev/core 4.5.2 → 4.5.4
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 +12 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/form/useForm.d.ts.map +1 -1
- package/dist/hooks/show/useShow.d.ts.map +1 -1
- package/dist/iife/index.js +3 -3
- package/dist/iife/index.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/form/useForm.ts +9 -4
- package/src/hooks/show/useShow.ts +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refinedev/core",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.4",
|
|
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",
|
|
@@ -246,11 +246,16 @@ export const useForm = <
|
|
|
246
246
|
// id state is needed to determine selected record in a context for example useModal
|
|
247
247
|
const [id, setId] = React.useState<BaseKey | undefined>(defaultId);
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* In some cases, `id` from the router params is not available at the first render.
|
|
251
|
+
*
|
|
252
|
+
* (e.g. when using `Next.js` and client-side-rendering, `router` is not ready to use at the first render)
|
|
253
|
+
*
|
|
254
|
+
* We're watching for `defaultId` changes and setting `id` state if it's not equal to `defaultId`.
|
|
255
|
+
*/
|
|
249
256
|
React.useEffect(() => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
}, [idFromProps]);
|
|
257
|
+
setId(defaultId);
|
|
258
|
+
}, [defaultId]);
|
|
254
259
|
|
|
255
260
|
/** `resourceName` fallback value depends on the router type */
|
|
256
261
|
const resourceName =
|
|
@@ -108,9 +108,7 @@ export const useShow = <
|
|
|
108
108
|
const [showId, setShowId] = useState<BaseKey | undefined>(defaultId);
|
|
109
109
|
|
|
110
110
|
React.useEffect(() => {
|
|
111
|
-
|
|
112
|
-
setShowId(defaultId);
|
|
113
|
-
}
|
|
111
|
+
setShowId(defaultId);
|
|
114
112
|
}, [defaultId]);
|
|
115
113
|
|
|
116
114
|
/** `resourceName` fallback value depends on the router type */
|