[BUG] Refine > 3.20 NextJs Antd useEditableTable and useModalForm hooks do not work
See original GitHub issueDescribe the bug
On nextjs refine version greater than 3.20, some antd hooks do not work: useEditableTable and useModalForm
To Reproduce Steps to reproduce the behavior:
- Instantiate a nextjs refine project
npx superplate-cli -p refine-nextjs tutorial
✔ Cloned remote source successfully.
✔ What will be the name of your app · tutorial
✔ Do you want to use an UI Framework?: · antd
✔ Do you want to customize theme?: · css
✔ Data Provider: · custom-json-rest-data-provider
✔ Auth Provider: · custom-auth-provider
✔ Do you want to add an example page? · example-resource
✔ Do you want to customize layout? · custom-layout
✔ i18n - Internationalization: · i18n-antd
✔ Would you like to share your choices with us anonymously? · no
- Edit posts list screen
Use ‘useEditableTable’ instead of 'useTable’i in ‘/src/components/posts/list.tsx’
const {
isEditing,
saveButtonProps,
cancelButtonProps,
editButtonProps,
tableProps, sorter } = useEditableTable<IPost>({});
<Table.Column<IPost>
title="Inline Actions"
dataIndex="inlineActions"
key="inlineActions"
render={(_text, record) => {
if (isEditing(record.id!!)) {
return (
<Space>
<SaveButton {...saveButtonProps} size="small" />
<Button {...cancelButtonProps} size="small">
Cancel
</Button>
</Space>
);
}
return (
<Space>
<EditButton
{...editButtonProps(record.id!!)}
size="small"
/>
</Space>
);
}}
/>
- Launch server and go to posts listing page: http://localhost:3000/posts
- You are redirected on https://api.fake-rest.refine.dev/posts/undefined
Expected behavior
Inline editing must be active.
If I use the web app version of refine npx superplate-cli -p refine-react tutorial
, it works.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[BUG] refine 3.23.2 does not work on nextjs: Multiple children ...
Describe the bug The last version of refine 3.23.3 does not work with ... other issues with antd hooks : useEditableTable and useModalForm...
Read more >Funny Modal hook BUG - Ant Design
BUG. From the figure above, we can see that when contextHolder is placed inside Modal , the pop-up position of the hooks call...
Read more >useModalForm - Refine Dev
useModalForm hook allows you to manage a form within a modal. It returns Ant Design Form and Modal components props.
Read more >Nextjs throws React has detected a change in the order of ...
Using hooks this way is a bad practice for this exact reason. It works fine, but only under certain conditions, making the code...
Read more >useModalForm
close, Specify a function that can close the modal, () => void. visible, Whether the modal dialog is visible or not, boolean. formProps,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found a fix. As you suggested, I have updated to the latest version of next.js Then I set in next.config.js the experimental feature:
newNextLinkBehavior: true
Can you upgrade your Next.js dependency to the latest version? (I updated the version now on superplate)
npm i next@latest