You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 27, 2025. It is now read-only.
Here are same observations from my brief investigation on how this library could be updated to React 18 and most notably the createRoot mechanic. Hopefully these remarks can be useful if that journey ever comes around.
Changing the render method invocation in inject method of ReactDomFactory.js to createRoot is quite straightforward, but we will probably need to stash the returned root values somewhere and use them later for unmounting in dispose
Unit tests might break badly since in React 18 the rendering is no longer an instant synchronous operation and the unit tests seem to expect this, consider for example:
The second parameter to App is a callback that probably gets invoked once react-habitat thinks things are done. It works fine pre-createRoot. However, swicthing to createRoot breaks this test since nothing will appear in node at the time when this callback gets executed. Wrapping the expects into a timeout makes the test pass, but the root cause probably needs to be fixed elsewhere in the library:
Additionally, when observing the unit test output in a Karma-browser window I can see the component render. To me these findings suggest that it is the no-longer-synchronous React 18 rendering that is the problem here.
Helloes,
Here are same observations from my brief investigation on how this library could be updated to React 18 and most notably the
createRootmechanic. Hopefully these remarks can be useful if that journey ever comes around.Changing the
rendermethod invocation ininjectmethod ofReactDomFactory.jstocreateRootis quite straightforward, but we will probably need to stash the returnedrootvalues somewhere and use them later for unmounting indisposeUnit tests might break badly since in React 18 the rendering is no longer an instant synchronous operation and the unit tests seem to expect this, consider for example:
The second parameter to
Appis a callback that probably gets invoked oncereact-habitatthinks things are done. It works fine pre-createRoot. However, swicthing tocreateRootbreaks this test since nothing will appear innodeat the time when this callback gets executed. Wrapping theexpects into a timeout makes the test pass, but the root cause probably needs to be fixed elsewhere in the library:Additionally, when observing the unit test output in a Karma-browser window I can see the component render. To me these findings suggest that it is the no-longer-synchronous React 18 rendering that is the problem here.
Good luck!