Skip to content

[BUG] Shown Warning : useLayoutEffect does nothing on the server... (When choose antd UI Framework) #1493

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
illusi03 opened this issue Jan 30, 2022 · 8 comments · Fixed by #1578 or #1726
Assignees
Labels
bug Something isn't working to be continued

Comments

@illusi03
Copy link

illusi03 commented Jan 30, 2022

Describe the bug
Fresh installation with Antd , but shown Warning
useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI.

To Reproduce
Steps to reproduce the behavior:

  1. Fresh installation from npx superplate-cli [project_name]
  2. Choose Refine With NextJs
  3. Choose with antd UI Framework

Expected behavior
Not showing warning

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 97.0.4692.99 (Official Build) (64-bit)
  • Used dataProvider Strapi

Additional context
Thankyou very much

@illusi03 illusi03 added the bug Something isn't working label Jan 30, 2022
@omeraplak
Copy link
Contributor

Hey @illusi03 ,
Thank you very much for contacting us. Let's see what we can do for this issue :)

@illusi03
Copy link
Author

illusi03 commented Feb 2, 2022

Thank you for response this issue @omeraplak

@omeraplak
Copy link
Contributor

Hey @illusi03 ,
I found the source of this issue in Ant Design issues. I guess we have to wait a bit :)

ant-design/ant-design#30396

@omeraplak
Copy link
Contributor

Hey @illusi03 ,
We've released @pankod/refine-antd@3.3.2. Could you approve this fix?
BTW, Thank you @tspvivek !

@illusi03
Copy link
Author

Hey @illusi03 , We've released @pankod/refine-antd@3.3.2. Could you approve this fix? BTW, Thank you @tspvivek !

Thankyou verymuch mr

@duong98
Copy link

duong98 commented Apr 15, 2022

@omeraplak hello, it seems in recent versions of refine this issue pop up again, i think it may have to do with nextjs-router components import ErrorComponent which in turn use a useLayoutEffect hook. Here is the code that i think raised the warning
useLayoutEffect(() => { if (params.resource) { const resourceFromRoute = resource(params.resource);
A possible fix should be import useLayoutEffect from 'rc-utils' instead of 'react', like this merge

@omeraplak omeraplak reopened this Apr 15, 2022
@omeraplak
Copy link
Contributor

omeraplak commented Apr 15, 2022

Hey @duong98,
Thanks so much for letting me know. Today we will deal with this issue 🎉

@omeraplak
Copy link
Contributor

Hey @duong98 ,
We've released 3.14.1. Could you approve this fix?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working to be continued
Projects
None yet
3 participants