mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-10-09 21:21:18 +11:00
fix: preserve selections when config import is invalid (#4994)
* fix: validate imports before replacing selections * test: cover atomic config imports * docs: explain stale config imports --------- Co-authored-by: Guilherme de Oliveira Rocha <contatoguilhermeoliveira@protonmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
co-authored by
Guilherme de Oliveira Rocha
Chris Titus
parent
2d0fd43bd3
commit
792122e998
@@ -84,15 +84,9 @@ function Invoke-WPFImpex {
|
||||
return
|
||||
}
|
||||
|
||||
# Clear all existing selections before importing so the import replaces
|
||||
# the current state rather than merging with it
|
||||
$sync.selectedAppx = [System.Collections.Generic.List[string]]::new()
|
||||
$sync.selectedApps = [System.Collections.Generic.List[string]]::new()
|
||||
$sync.selectedTweaks = [System.Collections.Generic.List[string]]::new()
|
||||
$sync.selectedToggles = [System.Collections.Generic.List[string]]::new()
|
||||
$sync.selectedFeatures = [System.Collections.Generic.List[string]]::new()
|
||||
|
||||
Update-WinUtilSelections -flatJson $flattenedJson
|
||||
# Build and validate every imported selection before replacing the current
|
||||
# state. This keeps a malformed config from leaving partial selections behind.
|
||||
Update-WinUtilSelections -flatJson $flattenedJson -Replace
|
||||
|
||||
if ($sync.Form) {
|
||||
Reset-WPFCheckBoxes -doToggles $true
|
||||
|
||||
Reference in New Issue
Block a user