From 6f4dbc71f223f52c16320f3c65be92f99075dfec Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 26 Oct 2018 13:11:47 -0700 Subject: Add back debounce --- packages/instant/src/containers/selected_erc20_asset_amount_input.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages/instant') diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts index 828c4fcb5..ee76e9d66 100644 --- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts +++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts @@ -79,6 +79,8 @@ const updateBuyQuoteAsync = async ( dispatch(actions.updateLatestBuyQuote(newBuyQuote)); }; +const debouncedUpdateBuyQuoteAsync = _.debounce(updateBuyQuoteAsync, 200, { trailing: true }); + const mapDispatchToProps = ( dispatch: Dispatch, _ownProps: SelectedERC20AssetAmountInputProps, @@ -95,7 +97,7 @@ const mapDispatchToProps = ( // even if it's debounced, give them the illusion it's loading dispatch(actions.setQuoteRequestStatePending()); // tslint:disable-next-line:no-floating-promises - updateBuyQuoteAsync(assetBuyer, dispatch, asset, value); + debouncedUpdateBuyQuoteAsync(assetBuyer, dispatch, asset, value); } }, }); -- cgit v1.2.3