Skip to content

TypeError: Cannot read properties of undefined (reading 'current') #95

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

Open
2 tasks done
RomanFausek opened this issue Feb 19, 2025 · 3 comments
Open
2 tasks done

Comments

@RomanFausek
Copy link

RomanFausek commented Feb 19, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Question

Hello,

I'm using next-urql, which has ssr-prepass built in. After upgrading to React 19 and Next.js 15, I'm encountering an issue. According to an urql maintainer, this seems to be related to your library. Could you provide guidance on resolving this?

Thank you!

urql-graphql/urql#3732 (reply in thread)

Edit 1:
I tried some dummy examples on the latest react and next packages and I am still getting the same error

if (typeof window === 'undefined') {
    // some dummy element (div) to run prepass on
    const element = createElement('div');

    await ssrPrepass(element);
  }
@RomanFausek
Copy link
Author

I understand this is a new issue, but could this get some attention, please? It could be a blocker for many users looking to upgrade. 🙏

I will try to bump you @carbonrobot since you did the React 19 support

@dardourimohamed
Copy link

@RomanFausek I made a little inspection on the source code and it's due to using react internal features, exactly here:

(React: any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ||

react team warned to never use this on production and now in react 19 they removed ReactCurrentDispatcher from the internals which react-ssr-prepass heavily depends on it

@RomanFausek
Copy link
Author

RomanFausek commented Apr 1, 2025

Yeah, I get it. The sad part is that our entire codebase was originally built around it by the devs before me. I went ahead and did the necessary refactor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants