react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

React throwing Warning: Unkown Props

Open FauzanKhan opened this issue 10 years ago • 20 comments

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/adazzle/react-data-grid/blob/master/CONTRIBUTING.md

Current behavior I'm on React version 0.14.8 and on initializing the data grid as given here, I get the following errors in the console:

VM3181:27 Warning: Unknown props `enableCellSelect`, `columns`, `rowGetter`, `rowsCount`, `minHeight`, `onRowUpdated`, `minColumnWidth`, `columnEquality`, `rowHeight`, `enableRowSelect`, `rowKey`, `rowScrollTimeout`, `cellNavigationMode`, `headerRows`, `columnMetrics`, `cellMetaData`, `selectedRows`, `rowSelection`, `expandedRows`, `rowOffsetHeight`, `sortColumn`, `sortDirection`, `onSort`, `totalWidth`, `onViewportKeydown`, `onViewportKeyup`, `onViewportDragStart`, `onViewportDragEnd`, `onViewportDoubleClick`, `onColumnResize` on <div> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
    in div (created by Grid)
    in Grid (created by ReactDataGrid)
    in div (created by ReactDataGrid)
    in div (created by ReactDataGrid)
    in ReactDataGrid (created by UploadCsv)
    in div (created by UploadCsv)
    in UploadCsv

This is just one of the many similar warnings I'm getting

Here's how I'm initializing the grid -

<ReactDataGrid
              enableCellSelect={true}
              columns={columns}
              rowGetter={this.rowGetter}
              rowsCount={this.state.rows.length}
              minHeight={500}
              onRowUpdated={this.handleRowUpdated} />

Expected/desired behavior

Reproduction of the problem If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior? The error is thrown multiple times for different props. None of the errors should be there.

What is the motivation / use case for changing the behavior?

FauzanKhan avatar Aug 09 '16 16:08 FauzanKhan

@FauzanKhan Thanks for that. We'll take a look

malonecj avatar Aug 10 '16 09:08 malonecj

I am getting the same error but on react 15.2.1

masterfung avatar Aug 10 '16 23:08 masterfung

Same error here on react 15.3.1

moraleslos avatar Aug 23 '16 17:08 moraleslos

Same error here on react 15.0.2

ghost avatar Aug 29 '16 09:08 ghost

Seems to be this line:

https://github.com/adazzle/react-data-grid/blob/ac42cb60dba24a3b95c28e726bd5f0589a1c1045/src/Grid.js#L84

This seems to be in several places:

https://github.com/adazzle/react-data-grid/blob/master/src/Row.js#L205

cwiese avatar Sep 06 '16 10:09 cwiese

@malonecj hay! It's been a month ago still the same problem in last version, any progress?.. =)

Timopheym avatar Sep 12 '16 12:09 Timopheym

Any news?

jpacora avatar Sep 14 '16 05:09 jpacora

hi, any new status on this issue. A great table manager BTW!

jabidof avatar Sep 17 '16 21:09 jabidof

same thing here with react 15.3.2

grex84 avatar Sep 19 '16 18:09 grex84

still here on react-data-grid v1.0.44 https://github.com/adazzle/react-data-grid/pull/457 @richardware @malonecj

yeliex avatar Sep 21 '16 14:09 yeliex

I've proposed #468 to remove the div props, but tests have started failing. There are also warnings:

Warning: ReactDOMComponent: Do not access .props of a DOM node; instead, recreate the props as render did originally or read the DOM properties/attributes directly from this node (e.g., this.refs.box.className).

Does react-data-grid rely on these div properties?

Wilfred avatar Sep 23 '16 20:09 Wilfred

any news here ?

haunguyen90 avatar Sep 27 '16 08:09 haunguyen90

Alternatively, you can work around this by filtering out the warning in dev builds:

let originalConsoleError = null;

// Patch console.error to ignore all errors that match the pattern given.
function ignoreConsoleErrors(pattern) {
  originalConsoleError = console.error;

  console.error = function(...args) {
    let message = null;
    if (_.isString(args[0])) {
      message = args[0];
    }

    // Skip the message if it matches.
    if (message && message.match(pattern)) {
      return;
    }

    // Otherwise, continue to console.error as normal.
    return originalConsoleError.apply(console, args);
  };
}

function restoreConsoleError() {
  console.error = originalConsoleError;
}

const NodeViewer = React.createClass({
  componentWillMount() {
    if (process.env.NODE_ENV == "dev") {
      // Work around https://github.com/adazzle/react-data-grid/issues/418
      ignoreConsoleErrors(/^Warning: Unknown props [\s\S]*created by ReactDataGrid/);
    }
  },

  componentWillUnmount() {
    if (process.env.NODE_ENV == "dev") {
      restoreConsoleError();
    }
  },

  render() {
    // ... use a react-data-grid
  }
});

Wilfred avatar Sep 27 '16 21:09 Wilfred

+1

couzic avatar Oct 03 '16 11:10 couzic

@Wilfred Thanks so much for the temporary workaround! To be safe we can be more specific with the match:

ignoreConsoleErrors(/^Warning: Unknown props [\s\S]* on <div> tag[\s\S]*created by ReactDataGrid/);

Also apparently process.env.NODE_ENV !== "production" is the common nomenclature!

yoiang avatar Oct 05 '16 20:10 yoiang

Is anyone working on this? I see only closed PRs. Would be great to know if this is a long way off or if you still need a PR-fix

slackday avatar Oct 13 '16 19:10 slackday

Any update on this. I am facing same problem

KalpanaPagariya avatar Nov 03 '16 12:11 KalpanaPagariya

Same here, can't make it work at all :(

daniel1943 avatar Nov 10 '16 15:11 daniel1943

Still have the warnings

uiruson avatar Nov 19 '16 00:11 uiruson

Fixed in #528

malonecj avatar Nov 21 '16 10:11 malonecj