React-data-grid: Deprecation warnings on default props

Created on 28 Nov 2018  ·  16Comments  ·  Source: adazzle/react-data-grid

Which version of React JS are you using?

✅ Officially supported ✅

  • [ ] v15.4.x

⚠️ Not officially supported, expect warnings ⚠️

  • [ ] v15.5.x
  • [x] v15.6.x

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

  • [ ] v16.x.x

Which browser are you using?

✅ Officially supported ✅

  • [ ] IE 9 / IE 10 / IE 11
  • [ ] Edge
  • [x] Chrome

⚠️ Not officially supported, but "should work" ⚠️

  • [ ] Firefox
  • [ ] Safari

I'm submitting a ...

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

Issue Details

Since at least version 5.0.3 of react-data-grid, I get deprecation warnings for every use of the ReactDataGrid for using the deprecated enableRowSelect and rowScrollTimeout props, without me ever using them. I think it was caused by #1254.

Call in my code:

<ReactDataGrid
  onGridSort={this.handleGridSort}
  columns={this.state.columns}
  rowGetter={this.rowGetter}
  rowsCount={this.getSize()}
  minHeight={currContainerHeight-4}
  onColumnResize={this.onColumnResize}
  headerRowHeight={headerRowHeight} />

Two warnings show up in my console:

> enableRowSelect has been deprecated and will be removed in a future version. Please use rowSelection instead
> undefined

Other deprecated props like onRowUpdated don't show a warning, so I suspect it's got something to do with the defaultProps of enableRowSelect and rowScrollTimeout. The package react-is-deprecated has a closed issue on this, the defaultProps are passed through the propTypes as well so the deprecationWarning will trigger.

The warning message for rowScrollTimeout only has undefined as text because it's propType definition is missing the deprecationWarning() call, but that's another story.

https://github.com/adazzle/react-data-grid/blob/283a83c4b3678eeeb2f6a177e8bda300e44f40a9/packages/react-data-grid/src/ReactDataGrid.js#L132

I didn't digg deep enough into react-data-grid yet to see if just removing the 2 defaultProps will cause any side effects, in my case it worked.

Thanks!

PS: Is React 15.4 still the only officially supported version?

Accepted Will Accept PR

Most helpful comment

@ryanakallis

Workaround:
Set prop 'enableRowSelect' to null

Same workaround clears the other undefined caused by rowScrollTimeout as @ElmarFrerichs suspected

```
...
enableRowSelect={null}
rowScrollTimeout={null}
/>

Edit to include version info:

"react": "^16.8.6",
"react-data-grid": "^6.1.0",
"react-data-grid-addons": "^6.1.0",
```
Still a valid workaround for suppressing deprecated prop warnings.

All 16 comments

Same messages here!

+1

+1

+1 in @bentley/ui-components
Using react-data-grid 6.0.1. Please fix in 6.0.2.

+1 using 5.03

+1 using latest

+1 using

"react-data-grid": "^6.0.2-0",
"react-data-grid-addons": "^6.0.2-0",

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.

hay stale bot "react-data-grid": "^6.1.0-0", still has this issue. PR is seems like ready to fix it though.

looks like they're actively working on a new major release which i'm sure will include this PR -> https://github.com/adazzle/react-data-grid/commits/next

doubt they will include this as part of a minor release before then but I could be wrong

+1 using 6.1.0

+1 using

"react-data-grid": "^6.1.0",
"react-data-grid-addons": "^6.1.0",

Awesome that y'all are sorting out console warnings (^^,)

Workaround:
Set prop 'enableRowSelect' to null :

<ReactDataGrid
  columns={this.state.columns}
  rowGetter={this.rowGetter}
  rowsCount={this.getSize()}

  enableRowSelect={null}

  />

The warning @ElmarFrerichs mentions :
undefined
is still there, no idea what that is.

@ryanakallis

Workaround:
Set prop 'enableRowSelect' to null

Same workaround clears the other undefined caused by rowScrollTimeout as @ElmarFrerichs suspected

```
...
enableRowSelect={null}
rowScrollTimeout={null}
/>

Edit to include version info:

"react": "^16.8.6",
"react-data-grid": "^6.1.0",
"react-data-grid-addons": "^6.1.0",
```
Still a valid workaround for suppressing deprecated prop warnings.

yup still happening by default at

    "react": "^16.8.6",
    "react-data-grid": "^6.1.0",
    "react-data-grid-addons": "^6.1.0",

@m1tttt4 solution will break current types definitions with \

Error:(127, 11) TS2322: Type 'null' is not assignable to type 'boolean | "single" | "multi" | undefined'.

Resolved in version 7.0.0-alpha.18, I'll reopen it if it happens again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

soma83 picture soma83  ·  4Comments

daniel1943 picture daniel1943  ·  3Comments

martinnov92 picture martinnov92  ·  3Comments

JordanBonitatis picture JordanBonitatis  ·  4Comments

oliverwatkins picture oliverwatkins  ·  4Comments