Closed kddige closed 2 years ago
I cannot reproduce the issue with mantine-next-template, it works correctly with latest version of Mantine and Next.js – https://github.com/mantinedev/mantine-next-template/blob/tooltip-issue-2609/components/Welcome/Welcome.tsx
If you have troubles with Next.js Mantine integration:
Hello,
I have the same problem, but unfortunately haven't found a solution yet.
I'll report when I've solved the problem.
Hello,
I have the same problem, but unfortunately haven't found a solution yet.
I'll report when I've solved the problem.
Any update on your issue? I have the same one. Actually, my case was tRPC is the culprit who cause the issue. The root cause leads back to the getServerSideProps api from NextJs. And ofc I have both react and react-dom at 18.2.0.
React and react-dom packages version needs to be 18 https://stackoverflow.com/questions/71682733/react-select-error-on-upgrade-typeerror-dispatcher-useinsertioneffect-is-not-a
No, I don't found a solution yet. :/ I tried to update my react and react-dom to 18, but it didn't fix it for me. My only solution was to create a new project, but I didn't implement trpc yet.
Hello, I have the same problem, but unfortunately haven't found a solution yet. I'll report when I've solved the problem.
Any update on your issue? I have the same one. Actually, my case was tRPC is the culprit who cause the issue. The root cause leads back to the getServerSideProps api from NextJs. And ofc I have both react and react-dom at 18.2.0.
For anyone interested in the issue behind tRPC. It's also addressed on their docs https://trpc.io/docs/v10/ssr
Github Issue: https://github.com/trpc/trpc/issues/596
@jimmyruann so you're saying mantine doesn't work with trpc with SSR set to true?
@viczam As per my project requirement, we create our own getInitialProps
following the Mantine guide here.
Here is the codesandbox link so you can sus it out.
@jimmyruann Hm, the codesandbox example has the same issue (I also followed the template from here - https://github.com/mantinedev/mantine-next-template).
But I've done some thinking and as much as I like the convenience of trpc with ssr: true
, it's not the best idea. I will prefetch the queries in getServerSideProps / getStaticProps whenever needed, and that works fine with mantine.
What package has an issue
@mantine/core
Describe the bug
When using @mantine/core popover, or any of its siblings (Menu.Dropdown or Tooltip), with Next.JS SSR (Server side rendering), and exception is thrown:
This only happens if doing SSR, and not if the component is rendered client side. It is possible to workaround this, by simply not rendering the component until client side hydration, for example:
However this gives a server/client mismatch.
My initial guess would be, that the @floating-ui package is looking for a ref, thats not yet created due to SSR.
What version of @mantine/hooks page do you have in package.json?
5.5.0
If possible, please include a link to a codesandbox with the reproduced problem
No response
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
Yes
Possible fix
No response