GriddleGriddle / Griddle

Simple Grid Component written in React
http://griddlegriddle.github.io/Griddle/
MIT License
2.5k stars 377 forks source link

Storybook has a failing case on master #858

Open docrinehart opened 5 years ago

docrinehart commented 5 years ago

Griddle main > with custom griddle key that doesn't exist

Griddle: Property 'garbage' doesn't exist in row data. Please specify a rowKey that exists in <RowDefinition>
    Error: Griddle: Property 'garbage' doesn't exist in row data. Please specify a rowKey that exists in <RowDefinition>
    at transformData (http://localhost:6006/main.771f17111d3e896ed4f6.bundle.js:6810:11)
    at Module.GRIDDLE_INITIALIZED (http://localhost:6006/main.771f17111d3e896ed4f6.bundle.js:5509:97)
    at GRIDDLE_INITIALIZED (http://localhost:6006/main.771f17111d3e896ed4f6.bundle.js:4216:83)
    at http://localhost:6006/main.771f17111d3e896ed4f6.bundle.js:6602:14
    at http://localhost:6006/vendors~main.771f17111d3e896ed4f6.bundle.js:26792:31
    at callReducerWithBeforeAfterPipe (http://localhost:6006/main.771f17111d3e896ed4f6.bundle.js:6607:10)
    at reducer (http://localhost:6006/main.771f17111d3e896ed4f6.bundle.js:6617:12)
    at p (<anonymous>:1:36402)
    at v (<anonymous>:1:36684)
    at <anonymous>:1:40069
lvaldovinos commented 5 years ago

hey @docrinehart, I'm taking a look at this one, I'll try to figure out what the problem is.

lvaldovinos commented 5 years ago

hey @docrinehart this is the expected functionality as far as I can see, when Griddle is initializing there's a reducer which is setting initial Immutable data object, you can take a look at src/utils/dataUtils.js:

  // Validate that the first item in our data has the custom Griddle key
  if (hasCustomRowId && data.length > 0 && !data[0].hasOwnProperty(renderProperties.rowProperties.rowKey)) {
    throw new Error(`Griddle: Property '${renderProperties.rowProperties.rowKey}' doesn't exist in row data. Please specify a rowKey that exists in <RowDefinition>`);
  }

I also took a look at the 1.13.1 tag, and this story is also failing there. so I think you can close this issue.

cc @ryanlanciaux