mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-24 20:32:51 -05:00
idk
This commit is contained in:
@@ -41,12 +41,21 @@ const DlcSelectionDialog = ({
|
|||||||
const [selectAll, setSelectAll] = useState(true)
|
const [selectAll, setSelectAll] = useState(true)
|
||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
|
|
||||||
|
// Reset dialog state when it opens or closes
|
||||||
|
useEffect(() => {
|
||||||
|
if (!visible) {
|
||||||
|
setInitialized(false)
|
||||||
|
setSelectedDlcs([])
|
||||||
|
setSearchQuery('')
|
||||||
|
}
|
||||||
|
}, [visible])
|
||||||
|
|
||||||
// Initialize selected DLCs when DLC list changes
|
// Initialize selected DLCs when DLC list changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (dlcs.length > 0) {
|
if (dlcs.length > 0) {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
// Initial setup - preserve the enabled state from incoming DLCs
|
// Create a new array to ensure we don't share references
|
||||||
setSelectedDlcs(dlcs)
|
setSelectedDlcs([...dlcs])
|
||||||
|
|
||||||
// Determine initial selectAll state based on if all DLCs are enabled
|
// Determine initial selectAll state based on if all DLCs are enabled
|
||||||
const allSelected = dlcs.every((dlc) => dlc.enabled)
|
const allSelected = dlcs.every((dlc) => dlc.enabled)
|
||||||
@@ -111,15 +120,6 @@ const DlcSelectionDialog = ({
|
|||||||
onConfirm(selectedDlcs)
|
onConfirm(selectedDlcs)
|
||||||
}, [onConfirm, selectedDlcs])
|
}, [onConfirm, selectedDlcs])
|
||||||
|
|
||||||
// Reset dialog state when it opens or closes
|
|
||||||
useEffect(() => {
|
|
||||||
if (!visible) {
|
|
||||||
setInitialized(false)
|
|
||||||
setSelectedDlcs([])
|
|
||||||
setSearchQuery('')
|
|
||||||
}
|
|
||||||
}, [visible])
|
|
||||||
|
|
||||||
// Count selected DLCs
|
// Count selected DLCs
|
||||||
const selectedCount = selectedDlcs.filter((dlc) => dlc.enabled).length
|
const selectedCount = selectedDlcs.filter((dlc) => dlc.enabled).length
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ const DlcSelectionDialog = ({
|
|||||||
<Button
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
disabled={isLoading && loadingProgress < 10} // Briefly disable to prevent accidental closing at start
|
disabled={isLoading && loadingProgress < 10}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user