TypeError in Table._adjustBodyCells() due to array index out of bounds
See original GitHub issueExpected Behavior
State transitions caused by click on anchors/buttons defined in table body work as expected and no errors are logged.
Actual Behavior
Browser console logs: TypeError: Cannot read property ‘innerText’ of undefined and clicking on any anchor defined in table body does not cause state transition anymore.
Sample code
class HelloWorldApp extends React.Component {
constructor(props) {
super(props);
this.state = { showLayer: false, item: undefined};
}
_onClickEditItem(item) {
this.setState({showLayer: true, item: item})
}
_onSort(idx, asc) {
console.log('onSort');
}
render() {
const items = [{
name: 'My Test Item1',
shortName: 'test1',
description: 'bla fasel bum'
}, {
name: 'My Test Item2',
shortName: 'test2',
description: 'Lorem isum ...'
}, {
name: 'My Test Item3',
shortName: 'test3',
description: 'foo bar baz'
}, ];
const sortIndex = 1,
sortAscending = true;
const headerLabels = [
<FormattedMessage id="name" />,
<FormattedMessage id="shortName" />,
<FormattedMessage id="desc" />,
];
let child = null;
if(this.state.showLayer && this.state.item){
child = <Layer modal={true}><h2>{this.state.item.name}</h2></Layer>
}
return (
<App>
<Title>Hello World</Title>
<Table>
<TableHeader labels={headerLabels} sortIndex={sortIndex} sortAscending={sortAscending} onSort={this._onSort} />
<tbody>
{ items.map(item => {
return <TableRow key={item.shortName}>
<td><Anchor onClick={() => this._onClickEditItem(item)}>{item.name}</Anchor></td>
<td>{item.shortName}</td>
<td>{item.description}</td>
</TableRow>
})}
</tbody>
</Table>
{child}
</App>
);
}
};
Steps to Reproduce
- Run code above with v1.3.0.
- Click on any anchor.
- Compare result with v1.3.1
Your Environment
- Grommet version: 1.3.1
- Browser Name and version: Chromium 56.0.2924.76 / Firefox 52
- Operating System and version (desktop or mobile): Linux Mint 18.1 Cinnamon
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Fix the Array Index Out Of Bounds Excepiton in Java
The ArrayIndexOutOfBoundsException in Java is a runtime exception that occurs when an array is accessed with an illegal index.
Read more >Array Index Out Of Bounds Exception - java - Stack Overflow
It leads to two issues, So you are missing first element (0th) in array, and trying to get 10th element (which is not...
Read more >Array Index Out Of Bounds Exception in Java - GeeksforGeeks
The index of an array is an integer value that has value in the interval [0, n-1], where n is the size of...
Read more >Index outside bounds of array error - Office - Microsoft Learn
"Index was outside the bounds of the array" error when you import data from multiple tables in a SQL Server database to an...
Read more >Index was outside the bounds of the array - Microsoft Power BI ...
Solved: Hi @all, I am importing NetSuite Data into power bi using odbc connection. When the tables are imported into power bi using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Shame on me, sorry folks. I’ve fixed this on https://github.com/grommet/grommet/commit/cd5b9ac23cfba79682dc805ff7a84367a9c0bb9b
I will soon release 1.3.2 with this fix, there are a couple of other items I will include in this release as well.
Awesome! Thanks.