From c7e91b4eea0cd6530c2761c971699c4d7ef59640 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 26 Nov 2021 10:27:39 +1100 Subject: [PATCH] Half the number of `calculate` requests We already have a `useEffect` that re-calculates the margin, no need to do it again the onChange handler. --- taker-frontend/src/App.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/taker-frontend/src/App.tsx b/taker-frontend/src/App.tsx index ec372d6..b07ec57 100644 --- a/taker-frontend/src/App.tsx +++ b/taker-frontend/src/App.tsx @@ -128,16 +128,6 @@ export const App = () => { onQuantityChange={(valueString: string) => { setUserHasEdited(true); setQuantity(parse(valueString)); - if (!order) { - return; - } - let quantity = valueString ? Number.parseFloat(valueString) : 0; - let payload: MarginRequestPayload = { - leverage: order.leverage, - price: order.price, - quantity, - }; - calculateMargin(payload); }} onLongSubmit={makeNewOrderRequest} isLongSubmitting={isCreatingNewOrderRequest}