-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mantine >v5.3.3 is not working with Next.js SSR (TypeError: useInsertionEffect) #2880
Comments
I found a same error
|
downgrading to |
Update react and react dom versions to 18, reinstall dependencies – https://stackoverflow.com/questions/71682733/react-select-error-on-upgrade-typeerror-dispatcher-useinsertioneffect-is-not-a Duplicate of #2609 |
My react and react-dom dependencies are >18:
I guess that's not the problem. |
Try reinstalling dependencies and cleaning cache, you can also use mantine-next-template, it does not have such issue |
Unfortunately, I still get this error which blocks me from upgrading to the latest mantine versions. But I found out that I don't get this error when I disable SSR in my tRPC settings. |
@quick0831 Since you are getting the exact error as me: Are you also using tRPC with SSR enabled? |
Actually I forgot it. I remember turning off ssr in trpc and it stop complaining. |
Did you fix it?, im having the same problem with react-ssr-prepass |
After upgrading to the newest mantine version (
Note: I am not using the next.js app directory. When I disable SSR in tRPC, the error disappears. So, there is still an issue with newer mantine versions and SSR. |
You can use one of the templates as reference. Templates do not have ssr issues. |
I'm having the same problem, just upgraded everything with |
I'm having the same Had to go with turning off SSR in the tRPC config for now. Hopefully there will be a fix that doesn't require this down the line. Note: After some messing around, I found that I don't get the error with some of the components even with SSR enabled. It appears the Mantine's |
It appears Mantine does not play nice with NextJS SSR. Tried the suggestions (see below) from the library author. Did not work. mantinedev/mantine#2880
It was the same for me. Commenting out the |
I use Mantine, but without any There still must be another mantine component, which breaks tRPC SSR. :( |
Is there any workaround to use tRPC |
@peter-wd-1 // Load completely on the client to avoid ssr error
const Select = dynamic(() => import("@mantine/core").then((el) => el.Select), {
loading: () => <p>Loading...</p>,
ssr: false,
}); It works well for what I am doing, I hope this helps someone else. |
Tooltips are also broken. Here's a workaround specific to tooltips that avoids that pieces of the text (the ones with the tooltips) are missing or replaced with “Loading…” during the dynamic load. // Load completely on the client to avoid SSR error
// https://github.com/mantinedev/mantine/issues/2880#issuecomment-1617136855
import dynamic from 'next/dynamic'
import { TooltipProps } from '@mantine/core'
export const Tooltip = ({ children, ...rest }: TooltipProps) => {
const MantineTooltip = dynamic(
() => import('@mantine/core').then((el) => el.Tooltip),
{
loading: () => <>{children}</>,
ssr: false,
},
)
return <MantineTooltip {...rest}>{children}</MantineTooltip>
} |
@Telofy Do you know if your workaround is still required on latest (7.6.1)? Having issues with timeouts with NextJS, and trying to diagnose the root cause with virtually no logs. |
What package has an issue
@mantine/core
Describe the bug
I am using mantine version
^5.3.3
with next.js13.0.1
.When I upgrade to a newer mantine version, e.g.
^5.4.0
or^5.7.0
I get the following error when opening my website:Thanks for this awesome library and taking time for this issue :)
What version of @mantine/hooks page do you have in package.json?
^5.4.0
The text was updated successfully, but these errors were encountered: