From 100c37b855707554cc83b8f3399b9640b233ef3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Wed, 7 Feb 2018 18:18:42 +0100 Subject: [PATCH] Fix addFakeDatasOnAccounts --- src/components/DashboardPage.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/DashboardPage.js b/src/components/DashboardPage.js index 84f04c66..1267ea83 100644 --- a/src/components/DashboardPage.js +++ b/src/components/DashboardPage.js @@ -78,6 +78,7 @@ class DashboardPage extends PureComponent { const listAccounts = [...accounts] while (listAccounts.length % ACCOUNTS_BY_LINE !== 0) listAccounts.push(null) + return chunk(listAccounts, ACCOUNTS_BY_LINE) } @@ -91,13 +92,15 @@ class DashboardPage extends PureComponent { const { accounts } = this.props this.setState(prev => ({ - fakeDatas: accounts.reduce((res, acc, i) => { - if (res[i]) { - const nextIndex = res[i].length - res[i][nextIndex] = generateFakeData(nextIndex) - } - return res - }, prev.fakeDatas), + fakeDatas: [ + ...accounts.reduce((res, acc, i) => { + if (res[i]) { + const nextIndex = res[i].length + res[i][nextIndex] = generateFakeData(nextIndex) + } + return res + }, prev.fakeDatas), + ], })) this.addFakeDatasOnAccounts()