diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx index 0af8f4c99..64676bbc3 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx @@ -35,18 +35,15 @@ export const ThroughputInput: FunctionComponent = ({ setIsThroughputCapExceeded, onCostAcknowledgeChange, }: ThroughputInputProps) => { - const [isAutoscaleSelected, setIsAutoScaleSelected] = useState(true); - const [throughput, setThroughput] = useState(() => { - if ( - isFreeTier || - isQuickstart || - [Constants.WorkloadType.Learning, Constants.WorkloadType.DevelopmentTesting].includes(getWorkloadType()) - ) { - return AutoPilotUtils.autoPilotThroughput1K; - } + const defaultThroughput: number = + isFreeTier || + isQuickstart || + [Constants.WorkloadType.Learning, Constants.WorkloadType.DevelopmentTesting].includes(getWorkloadType()) + ? AutoPilotUtils.autoPilotThroughput1K + : AutoPilotUtils.autoPilotThroughput4K; - return AutoPilotUtils.autoPilotThroughput4K; - }); + const [isAutoscaleSelected, setIsAutoScaleSelected] = useState(true); + const [throughput, setThroughput] = useState(defaultThroughput); const [isCostAcknowledged, setIsCostAcknowledged] = useState(false); const [throughputError, setThroughputError] = useState(""); const [totalThroughputUsed, setTotalThroughputUsed] = useState(0); @@ -56,7 +53,6 @@ export const ThroughputInput: FunctionComponent = ({ const throughputCap = userContext.databaseAccount?.properties.capacity?.totalThroughputLimit; const numberOfRegions = userContext.databaseAccount?.properties.locations?.length || 1; - useEffect(() => { // throughput cap check for the initial state let totalThroughput = 0; @@ -166,11 +162,6 @@ export const ThroughputInput: FunctionComponent = ({ const handleOnChangeMode = (event: React.ChangeEvent, mode: string): void => { if (mode === "Autoscale") { - const defaultThroughput = - isFreeTier || - [Constants.WorkloadType.Learning, Constants.WorkloadType.DevelopmentTesting].includes(getWorkloadType()) - ? AutoPilotUtils.autoPilotThroughput1K - : AutoPilotUtils.autoPilotThroughput4K; setThroughput(defaultThroughput); setIsAutoScaleSelected(true); setThroughputValue(defaultThroughput);