Skip to content

Commit

Permalink
Fix [CPU] Possibility to receive negative CPU values due to decrease …
Browse files Browse the repository at this point in the history
…value in range from 2 to 99 millicpu (#2189)
  • Loading branch information
Taras-Hlukhovetskyi authored Jan 18, 2024
1 parent 75a2b93 commit 5dacb26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/RangeInput/RangeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ const RangeInput = ({
const handleIncrease = () => {
if (inputValue >= max) return

const value = isCurrentValueEmpty() ? step : Number(inputValue) + step
let value = isCurrentValueEmpty() ? step : Number(inputValue) + step
value = max && value > max ? max : value
const nextValue = isInteger(value) ? value : value.toFixed(3)

setInputValue(nextValue)
Expand All @@ -75,7 +76,8 @@ const RangeInput = ({
const handleDecrease = () => {
if (inputValue <= 0 || inputValue <= min) return

const value = isCurrentValueEmpty() ? -step : Number(inputValue) - step
let value = isCurrentValueEmpty() ? -step : Number(inputValue) - step
value = min && value < min ? min : value
const nextValue = isInteger(value) ? value : value.toFixed(3)

setInputValue(nextValue)
Expand Down

0 comments on commit 5dacb26

Please sign in to comment.