React-data-grid: Add support for React StrictMode (and therefore asynchronous rendering in the future)

Created on 3 Oct 2018  ·  11Comments  ·  Source: adazzle/react-data-grid

Which version of React JS are you using?

☣️ Not officially supported, expect warnings and errors ☣️

  • [x] v16.x.x

Which browser are you using?

✅ Officially supported ✅

- [x] Chrome

I'm submitting a ...

  • [ ] 🐛 Bug Report
  • [x] 💡 Feature Request

Issue Details

You're probably aware of the upcoming asynchronous rendering changes in React 17. To prepare for that, React have created the <React.StrictMode> element to highlight anything that uses some now deprecated lifecycle methods.

<React.StrictMode> highlights a few items in react-data-grid:

Warning: Unsafe lifecycle methods were found within a strict-mode tree:
in StrictMode (at App.jsx:44)

componentWillMount: Please update the following components to use componentDidMount instead: Canvas, Grid, HeaderRow, ReactDataGrid

componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: Canvas, Header, Provider, ReactDataGrid, Viewport

Learn more about this warning here:
https://fb.me/react-strict-mode-warnings

There's no great need to fix this at this stage as it doesn't actually impact anything yet

Most helpful comment

Still getting a Warning when running RDG with the current React version:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: ReactDataGrid, Viewport

All 11 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please reopen this if you feel it has been incorrectly closed and we will do our best to look into it. Thank you for your contributions.

This will need fixing at some point so that async rendering in react 16.7 will work

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please reopen this if you feel it has been incorrectly closed and we will do our best to look into it. Thank you for your contributions.

Still should be done

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please reopen this if you feel it has been incorrectly closed and we will do our best to look into it. Thank you for your contributions.

Should still be done, react concurrent rendering will come out at some point this year

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please reopen this if you feel it has been incorrectly closed and we will do our best to look into it. Thank you for your contributions.

still needs doing

RDG already supports react 16 and React.strictMode or any other react 16 feature can be used.

Still getting a Warning when running RDG with the current React version:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: ReactDataGrid, Viewport

I also get this problem - it's annoying but not shop stopping - unclear as to why fix has not been done yet?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanwtyler picture ryanwtyler  ·  3Comments

Suprit-S-M picture Suprit-S-M  ·  4Comments

soma83 picture soma83  ·  4Comments

localhosted picture localhosted  ·  4Comments

JimLynchCodes picture JimLynchCodes  ·  4Comments