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

react-reconciler.development.js:130 Uncaught TypeError: Cannot read property 'alternate' of undefined #171

Closed
PawelGIX opened this issue Feb 11, 2018 · 24 comments

Comments

@PawelGIX
Copy link

Any ideas what could be wrong?

image

@lavrton
Copy link
Member

lavrton commented Feb 13, 2018

@PawelGIX how can I reproduce?

@lavrton lavrton closed this as completed Mar 10, 2018
@Domino987
Copy link

@PawelGIX Did you find a fix?

@PawelGIX
Copy link
Author

PawelGIX commented Apr 1, 2020

I think there was something wrong with my build process. The problem no longer occurs.

@damiangreen
Copy link

damiangreen commented Aug 26, 2020

I'm now seeing this after attempting to upgrade to React 17.

Repro:
https://codesandbox.io/s/magical-shape-8vozl

@lavrton
Copy link
Member

lavrton commented Aug 26, 2020

I want to wait for official v17 release to make an update for react-konva.

@AonanLi
Copy link

AonanLi commented Oct 22, 2020

having this issue with "react": "16.13.1"

@lavrton
Copy link
Member

lavrton commented Oct 22, 2020

@AonanLi what react-konva version do you have? They should much and you should not have peer deps warnings.

@AonanLi
Copy link

AonanLi commented Oct 22, 2020

@AonanLi what react-konva version do you have? They should much and you should not have peer deps warnings.

I was using 17.0.0. I switched to 16.13.0-6 and it works now. Thanks for pointing that out!

@damiangreen
Copy link

React 17 is now officially released, will this lib be updated?

@lavrton
Copy link
Member

lavrton commented Oct 23, 2020

Already. npm install [email protected]

@damiangreen
Copy link

jsut to confirm [email protected] will only work with react 17 right? I jsut tried to install it into a react 16.x app with the erro above...

Great work on the library

@lavrton
Copy link
Member

lavrton commented Oct 23, 2020

You don't need to install the last react-konva it with react 16.x. Last react-konva update is just internal dependencies updates for compatibility with the last react.

@derit
Copy link

derit commented Oct 28, 2020

i'm using react 16.13.1
to solved this issue
yarn add react-conva@^16.13.0-6

@casamia918
Copy link

casamia918 commented Dec 27, 2020

Upgrade react and react-dom package to 17.0.1

{

    "@types/react": "^17.0.0", // for typescript
    "@types/react-dom": "^17.0.0", // for typescript
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "konva": "^7.2.0",
    "react-konva": "^17.0.1-3",

}

@flyon
Copy link

flyon commented Feb 17, 2021

@derit that did the trick for me too. But I think you meant konva not _c_onva.
So

yarn add react-konva@^16.13.0-6

Anyone still using react 16.x and adding react-konva with yarn add react-konva or npm install react-konva --save will currently run into this issue. So @lavrton I think a change in package.json to state that the latest version requires react 17, but not anything below it will help with this.

@lavrton
Copy link
Member

lavrton commented Feb 17, 2021

The package.json has: "react": ">=17.0.1", in peerDependencies. So I guess you had a peer dependencies warning and you just ignore it (as everybody else myself included). Probably I will add runtime warning back.

@sylvestrevgen
Copy link

@lavrton I have the same issue on React 16 - TypeError: Cannot read property 'alternate' of undefined. I installed react-konva and konva with just yarn add react-konva konva. What can I do to fix this issue?

@lavrton
Copy link
Member

lavrton commented Mar 11, 2021

Upgrade react and react-dom to the last version (recommended) or downgrade react-konva with npm install react-konva@^16 (not recommended).

@sylvestrevgen
Copy link

sylvestrevgen commented Mar 11, 2021 via email

@sylvestrevgen
Copy link

@lavrton I use React Starter Kit https://github.com/kriasoft/react-starter-kit

@lavrton
Copy link
Member

lavrton commented Mar 11, 2021

Or is it impossible cause server side?

It is impossible right now. react-konva will just render empty div without errors.

@sylvestrevgen
Copy link

@lavrton I understood. Thank you. I will not use canvas and will find another solution.

@NikulGoyani369
Copy link

it's working after updating react-konva npm packages.

@Siva-at-OFS
Copy link

Siva-at-OFS commented Nov 30, 2021

I got exact problem when I upgraded the react version from 16.3.0 to 17.0.0 and here's how I solved it.

Spoiler alert: Its a combination of version upgrade and minor code change.

Step 1: Upgraded both konva and react-konva to their latest packages available for me (~8.3.0 and ~17.0.2-5 respectively).

Step 2: Tested the application to find a different error but more controllable error (Your situation may differ depending on code)
image

Step 3: Since its not excepting the height and width of canvas element to be set to zero, I changed them to 1 (No significant impact on UI)

Feature is working as expected.

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