diff --git a/src/components/toolbox/table/index.js b/src/components/toolbox/table/index.js
index dd54daa009..cf3ba1b196 100644
--- a/src/components/toolbox/table/index.js
+++ b/src/components/toolbox/table/index.js
@@ -63,7 +63,7 @@ import styles from './table.css';
* you can use this property.
*/
const Table = ({
- data,
+ data = [],
loadData,
header,
row,
diff --git a/src/components/toolbox/table/table.test.js b/src/components/toolbox/table/table.test.js
index e809ef8bd2..b455d71c52 100644
--- a/src/components/toolbox/table/table.test.js
+++ b/src/components/toolbox/table/table.test.js
@@ -68,10 +68,17 @@ describe('Table', () => {
const wrapper = mount(
);
expect(wrapper.find('Row')).toHaveLength(props.data.length);
});
+
it('should render accept function to define iteration key', () => {
const iterationKey = jest.fn().mockImplementation(data => data.address);
mount();
expect(iterationKey.mock.calls.length).toBe(props.data.length);
});
+
+ it('should not crash when data is undefined', () => {
+ const wrapper = mount();
+ expect(wrapper.find('.empty-state')).toHaveLength(1);
+ expect(wrapper.find('Row')).toHaveLength(0);
+ });
});
});
diff --git a/src/store/reducers/voting.js b/src/store/reducers/voting.js
index 7d0b8e490e..7026cd1479 100644
--- a/src/store/reducers/voting.js
+++ b/src/store/reducers/voting.js
@@ -10,7 +10,7 @@ const voting = (state = {}, action) => {
switch (action.type) {
case actionTypes.votesRetrieved: {
if (action.data.account.votesUsed) {
- return action.data
+ return action.data.votes
.reduce((votesDict, delegate) => {
votesDict[delegate.address] = {
confirmed: Number(delegate.amount),