refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] create refine-app refine-mui shows warnings about useEffect usage out-of-the-box

Open cdietze opened this issue 2 years ago • 1 comments

Describe the bug

After creating a fresh starter project, warnings about useEffect hook usage are shown in the JS console. I am not sure which hooks are the cause.

Steps To Reproduce

  1. Create a fresh project using npm create refine-app -- -o refine-mui tutorial
  2. Start the dev server using npm run dev
  3. The JS-Console shows warnings:
Warning: Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks
    at xn (http://localhost:3000/static/js/bundle.js:98697:19)
    at SnackbarProvider (http://localhost:3000/static/js/bundle.js:134363:24)
    at http://localhost:3000/static/js/bundle.js:992:66
    at InnerThemeProvider (http://localhost:3000/static/js/bundle.js:58619:70)
    at ThemeProvider (http://localhost:3000/static/js/bundle.js:57687:5)
    at ThemeProvider (http://localhost:3000/static/js/bundle.js:58638:5)
    at App

Expected behavior

No warnings out-of-the-box.

Screenshot

No response

Desktop

  • OS: MacOS
  • refine-mui: 3.57.0

Mobile

No response

Additional Context

No response

cdietze avatar Nov 29 '22 10:11 cdietze

Hey @cdietze!

Sorry for the issue. We've identified the issue; we get the values of the notificationProvider inside a useMemo in <Refine /> component. For the @pankod/refine-mui's notificationProvider we've used notistack but since its providing the functions with a hook, we're having this warning as a result. 🤦

We're aiming to release a quick fix 🚀

aliemir avatar Nov 29 '22 12:11 aliemir

Hey @cdietze , We've released @pankod/[email protected]. Could you approve this fix?

omeraplak avatar Nov 30 '22 10:11 omeraplak

Yes, I can confirm: the warnings are gone. Thanks for the quick fix!

cdietze avatar Nov 30 '22 20:11 cdietze