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)
|
const [currentItemValue, setCurrentItemValue] = useState(rightSelectValue)
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
|
// if (currentItemSkill) sendValues(currentItemSkill.id, currentItemValue)
|
||||||
|
|
||||||
// Set default values from props
|
// Set default values from props
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -57,10 +58,6 @@ const SelectWithInput = ({
|
||||||
setCurrentItemValue(rightSelectValue)
|
setCurrentItemValue(rightSelectValue)
|
||||||
}, [leftSelectValue, rightSelectValue])
|
}, [leftSelectValue, rightSelectValue])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (currentItemSkill) sendValues(currentItemSkill.id, currentItemValue)
|
|
||||||
}, [currentItemSkill, currentItemValue])
|
|
||||||
|
|
||||||
// Methods: UI state management
|
// Methods: UI state management
|
||||||
function changeOpen(side: 'left' | 'right') {
|
function changeOpen(side: 'left' | 'right') {
|
||||||
if (side === 'left' && !leftSelectDisabled) {
|
if (side === 'left' && !leftSelectDisabled) {
|
||||||
|
|
@ -120,6 +117,7 @@ const SelectWithInput = ({
|
||||||
function handleRightSelectChange(rawValue: string) {
|
function handleRightSelectChange(rawValue: string) {
|
||||||
const value = parseFloat(rawValue)
|
const value = parseFloat(rawValue)
|
||||||
setCurrentItemValue(value)
|
setCurrentItemValue(value)
|
||||||
|
if (currentItemSkill) sendValues(currentItemSkill.id, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue