Skip to content
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

Uncaught TypeError: startTransition is not a function #3557

Closed
1 task done
liby opened this issue Jun 6, 2022 · 4 comments · Fixed by #3568
Closed
1 task done

Uncaught TypeError: startTransition is not a function #3557

liby opened this issue Jun 6, 2022 · 4 comments · Fixed by #3568

Comments

@liby
Copy link

liby commented Jun 6, 2022

  • Check if updating to the latest Preact version resolves the issue

Describe the bug
This is a bug related to Preact with Next.js. When an exception is throw in the render phase of a clientside rendered page the Next.JS pages/_error fails to render.

Using the latest [email protected] and [email protected] and [email protected] installed, changing the route (e.g. calling Router.replace, Router.push) will throw three errors(Local development):

  1. Error: Cancel rendering route
  2. Uncaught (in promise) TypeError: startTransition is not a function
  3. Uncaught TypeError: startTransition is not a function
    image

To Reproduce

Steps to reproduce the behavior:

  1. Go to Demo
  2. Open DevTools
  3. Click on any of the post links, page does not navigate to the specified page
  4. See error
    image

Expected behavior

The page navigates to the specified link as expected.

Notes

What is the reason for having React 18 installed alongside Preact?

I use React while developing and only replace it with Preact in production.

The same as mentioned in #3233, even if I add pages/failing and pages/_error, when an exception is throw in the render phase of a client-side rendered page the Next.js pages/_error fails to render.

Possibly related: #3512, #3502, #3233, preactjs/next-plugin-preact#53

@wesley0609
Copy link

I have the same issue.

@JLucasCAmorim
Copy link

Same here, any updates on this?

@jsphkhan
Copy link

The same issue when enabling preact via next config file

webpack: (config, { dev, isServer }) => {
    if (!dev && !isServer) {
      Object.assign(config.resolve.alias, {
        react: 'preact/compat',
        'react-dom/test-utils': 'preact/test-utils',
        'react-dom': 'preact/compat',
      });
    }

    return config;

However, I do not see this issue if I use the preact plugin - https://www.npmjs.com/package/next-plugin-preact

@dlarroder
Copy link

I also have the same issue, using preact version 10.8.2 in production but react 18.2.0 in development build. Any updates on this?

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

Successfully merging a pull request may close this issue.

5 participants