Fix infinite loop in SelectWithSelect
This commit is contained in:
parent
6f3c7d2a03
commit
6064d726ce
1 changed files with 2 additions and 4 deletions
|
|
@ -50,6 +50,7 @@ const SelectWithInput = ({
|
|||
const [currentItemValue, setCurrentItemValue] = useState(rightSelectValue)
|
||||
|
||||
// Hooks
|
||||
// if (currentItemSkill) sendValues(currentItemSkill.id, currentItemValue)
|
||||
|
||||
// Set default values from props
|
||||
useEffect(() => {
|
||||
|
|
@ -57,10 +58,6 @@ const SelectWithInput = ({
|
|||
setCurrentItemValue(rightSelectValue)
|
||||
}, [leftSelectValue, rightSelectValue])
|
||||
|
||||
useEffect(() => {
|
||||
if (currentItemSkill) sendValues(currentItemSkill.id, currentItemValue)
|
||||
}, [currentItemSkill, currentItemValue])
|
||||
|
||||
// Methods: UI state management
|
||||
function changeOpen(side: 'left' | 'right') {
|
||||
if (side === 'left' && !leftSelectDisabled) {
|
||||
|
|
@ -120,6 +117,7 @@ const SelectWithInput = ({
|
|||
function handleRightSelectChange(rawValue: string) {
|
||||
const value = parseFloat(rawValue)
|
||||
setCurrentItemValue(value)
|
||||
if (currentItemSkill) sendValues(currentItemSkill.id, value)
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue