-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Preact support #838
Comments
fwiw, i am using preact with the latest version of NextAuthJS and not having an issue |
@aequasi What versions of next, preact, nextauthjs, and node are you using? |
Does it work on the latest version of [email protected]? I will update this issue with a minimally reproducible repo. I am implementing the global Provider pattern in _app.tsx. Hopefully I'm able to show the bug without any external dependencies. |
Yeah, just updated and its still working |
@timothymiller did you solve the problem? I'm having the same problem and it is also regarding the context |
Yeah, unfortunately. I'll help with what I can, if you have questions |
I am also getting The error is thrown in Preact's |
hi, it is a problem by One good solution would be if |
@jembach Thank you for giving your input, but I don't think this is a viable solution. It sounds like you're discarding Preact for React in the production dependencies. My original error log from Preact version 10.0.x points to an issue with Preact's implementation of React Context. The React team has been making a lot of changes lately (Suspense, concurrent mode, etc). It is much more than a virtual DOM diffing library as compared to when it first started. While the bundle size is an area for improvement, I think Preact needs more time to match the spec for React. |
@timothymiller I have now looked in the changelogs of The I analyzed my
And when I install
So because
How to solve it in your
|
@jembach i wasn't aware next-auth specified a Preact version. For consistency sake, I should mention the last time I updated this issue, I was referring to version 10.5.5 of Preact. I will try your method of matching Preact versions in yarn.lock when I return from holiday break. |
FYI, worth noting that Preact has no plans to support the React Server Components, while NextJS does, so it may enb up not be feasible to continue using preact in the future. |
@aequasi care to share this magic code from 2 months ago that makes it all work? |
There was no "magic code" unfortunately. I just didn't have the issue |
@aequasi that's not how this works. That's not how any of this works. |
I gave you a reference (#838 (comment)) as to what did work for me, to help you iron out where your problem may be coming from. Perhaps if you upload a reproducible test case, someone may be able to help out more efficiently |
@aequasi Do any of your pages/components where you do auth use SSR? The errors I was getting was only during server side rendering (specifically with useContext); if the site was purely static it would have worked for me too. |
Can someone verify if this is still an issue? |
@balazsorban44 Yes, this is still an issue. Please advise. |
so just out of curiosity have you tried upgrading next and next-auth to their latest versions? Please also provide a reproduction repository. |
Describe the bug
Latest version of NextAuthJS (v3.1.0) and Preact (10.5.5) do not play nicely together
Cannot read property 'context' of undefined
Steps to reproduce
next-plugin-preact
over base projecthttps://www.npmjs.com/package/next-plugin-preact
Expected behavior
Drop in compatibility with Preact
Feedback
Works perfectly with React v17+, Preact's implementation of React Context seems to be the source of the issue.
[*] Could not find relevant documentation
The text was updated successfully, but these errors were encountered: