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

Not working with React 18 and StrictMode #67

Open
FezVrasta opened this issue Jun 4, 2022 · 5 comments
Open

Not working with React 18 and StrictMode #67

FezVrasta opened this issue Jun 4, 2022 · 5 comments

Comments

@FezVrasta
Copy link
Contributor

FezVrasta commented Jun 4, 2022

We are trying to upgrade to React 18 but this library doesn't seem to work with it when combined with StrictMode.

The problem resides in the way the data is initialized into the constructor calls and then deleted on componentWillUnmount. StrictMode forces the components render twice, and most of the react-vtk-js logic doesn't seem to handle this (it never expects the component to unmount while some of the mount operations are still running).

Do you think you could prioritize the work needed to support React 18 + StrictMode?

@FezVrasta
Copy link
Contributor Author

I think this could be a good opportunity to add TypeScript to the project and rewrite the components to be functional + hooks instead of classes?

@jourdain
Copy link
Collaborator

jourdain commented Jun 4, 2022

I think updating the library would be great especially fixing the contructor/componentWillUnmount asymmetry.

My only worry is that one consumer of that library is limited to react 16. I'm wondering if we could have a path where with the same code base we can build toward different react versions.

@FezVrasta
Copy link
Contributor Author

Are they blocked on 16.0 or 16.8+?

Hooks were introduced in 16.8 so we could use that as minimum version?

@jourdain
Copy link
Collaborator

jourdain commented Jun 4, 2022

They are using 16.14+

@FezVrasta
Copy link
Contributor Author

Ok that's great, there shouldn't be any issue if we decided to convert the library to hooks then

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