simularium / simularium-website

Front end website for the Simularium project, includes the Simularium viewer
https://simularium.allencell.org
Apache License 2.0
6 stars 3 forks source link

Fix/bump react #461

Closed interim17 closed 6 months ago

interim17 commented 7 months ago

Problem - React 18

Bumping react to be in sync with viewer.

A couple other dependencies seemed to need come along, react-dom, @types/react-dom, @types/react, react-waypoint. Also children is no longer a default prop on some components so I added it to a couple interfaces.

The only change that seems more significant is: In React 18 the legacy render method is replaced with createRoot.

Using the legacy API will cause the app to run as if its in React 17. We should use the new API so we are running the version we think we're running. The container for root could possible be null and these docs show this non-null assertion:

const root = createRoot(container); // createRoot(container!) if you use TypeScript

But that seems not safe and the linter doesn't like it so I used a ternary check, thoughts?

const container: HTMLElement | null = document.getElementById(APP_ID);
container !== null
    ? renderApp(container)
    : console.log("Could not find container element with id " + APP_ID);
github-actions[bot] commented 7 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements 73.24% 602/822
🟑 Branches 68.38% 80/117
πŸ”΄ Functions 40.31% 79/196
🟑 Lines 71.7% 537/749

Test suite run success

99 tests passing in 7 suites.

Report generated by πŸ§ͺjest coverage report action from 2e20eecedae7f5d671dcfb7f1628cbe8aa7a3342