From 07b6c9f48679f9c5d78a17fe30970911824d12e7 Mon Sep 17 00:00:00 2001 From: Vasek Mlejnsky Date: Wed, 29 Aug 2018 11:36:07 +0200 Subject: [PATCH] Change shape of returned object & temporary fix for async react-select --- src/actions/TokenActions.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/actions/TokenActions.js b/src/actions/TokenActions.js index a986ac76..46a7772f 100644 --- a/src/actions/TokenActions.js +++ b/src/actions/TokenActions.js @@ -37,20 +37,21 @@ export const load = (input: string, network: string): AsyncAction => async (disp const tokens = getState().localStorage.tokens[network]; const value = input.toLowerCase(); const result = tokens.filter(t => t.symbol.toLowerCase().indexOf(value) >= 0 - || t.address.toLowerCase().indexOf(value) >= 0 - || t.name.toLowerCase().indexOf(value) >= 0); + || t.address.toLowerCase().indexOf(value) >= 0 + || t.name.toLowerCase().indexOf(value) >= 0); if (result.length > 0) { - return { options: result }; + // TODO: Temporary fix for async select + // async react-select starts getting very laggy + // when options is a large list (>200 items) + return result.slice(0, 100); } const web3instance = getState().web3.find(w3 => w3.network === network); if (!web3instance) return; const info = await getTokenInfoAsync(web3instance.erc20, input); if (info) { - return { - options: [info], - }; + return [info]; } //await resolveAfter(300000); //await resolveAfter(3000);