Fix RaidCombobox not switching to raid's section
The RaidCombobox should always open to the section that contains the current raid, or the middle section if there is no raid selected. There was some spaghetti code, but this should fix it.
This commit is contained in:
parent
fd50258f99
commit
eaf863584d
1 changed files with 4 additions and 20 deletions
|
|
@ -115,29 +115,13 @@ const RaidCombobox = (props: Props) => {
|
|||
sortGroups(appState.raidGroups)
|
||||
}, [])
|
||||
|
||||
// Set current raid and section when the component mounts
|
||||
useEffect(() => {
|
||||
// if (appState.party.raid) {
|
||||
// setCurrentRaid(appState.party.raid)
|
||||
// if (appState.party.raid.group.section > 0) {
|
||||
// setCurrentSection(appState.party.raid.group.section)
|
||||
// } else {
|
||||
// setCurrentSection(1)
|
||||
// }
|
||||
// } else if (props.showAllRaidsOption && !currentRaid) {
|
||||
// setCurrentRaid(allRaidsOption)
|
||||
// }
|
||||
}, [])
|
||||
|
||||
// Set current raid and section when the current raid changes
|
||||
// Set current section when the current raid changes
|
||||
useEffect(() => {
|
||||
console.log('Raid has changed')
|
||||
if (props.currentRaid) {
|
||||
setCurrentRaid(props.currentRaid)
|
||||
if (appState.party.raid && appState.party.raid.group.section > 0)
|
||||
setCurrentSection(props.currentRaid.group.section)
|
||||
else setCurrentSection(1)
|
||||
} else {
|
||||
setCurrentRaid(undefined)
|
||||
setCurrentSection(1)
|
||||
}
|
||||
}, [props.currentRaid])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue