Remove the unconditional Default profile fallback

DeleteProfile no longer has a UI entry point, so the hardcoded
"Default" safety net it used to fall back to is no longer needed.
Unassigning a deleted profile now just clears the charProfile
mapping, and GetActiveProfileName/GetActiveClassSettings already
fall back to (and lazily recreate) the character's own auto-created
profile - the same thing that happens for a brand new character.
This commit is contained in:
2026-07-08 00:30:53 +02:00
parent 79f45e5c41
commit 65dcb96c1d
+7 -21
View File
@@ -161,24 +161,17 @@ HideCoA.ResetProfile = ResetProfile
local function DeleteProfile(name)
if name == "Default" then
return
end
local wasActive = (name == GetActiveProfileName())
HideCoADB.profiles[name] = nil
for charKey, assigned in pairs(HideCoADB.charProfile) do
if assigned == name then
-- Unassigning falls back to the character's own auto-created
-- profile (see GetActiveProfileName/GetActiveClassSettings),
-- which gets recreated on demand if it doesn't exist.
HideCoADB.charProfile[charKey] = nil
end
end
if wasActive then
HideCoADB.charProfile[GetCharacterKey()] = "Default"
end
end
HideCoA.DeleteProfile = DeleteProfile
@@ -362,18 +355,11 @@ f:SetScript("OnEvent", function(self, event, arg1)
end
-- Legacy pre-profile saved variables stored a single flat classSettings
-- table shared by every character. Fold it into "Default" so nobody's
-- existing hide/show choices vanish when profiles were introduced.
if HideCoADB.classSettings and not HideCoADB.profiles["Default"] then
HideCoADB.profiles["Default"] = { classSettings = HideCoADB.classSettings }
end
-- table shared by every character. Fold it into whichever character
-- happens to load next so those hide/show choices don't just vanish.
local legacyFlatClassSettings = HideCoADB.classSettings
HideCoADB.classSettings = nil
if not HideCoADB.profiles["Default"] then
HideCoADB.profiles["Default"] = { classSettings = CreateDefaultClassSettings() }
end
local charKey = GetCharacterKey()
-- The profile-name syntax used to be "realm - character"; rename any
@@ -407,7 +393,7 @@ f:SetScript("OnEvent", function(self, event, arg1)
end
if not HideCoADB.profiles[charKey] then
HideCoADB.profiles[charKey] = { classSettings = CreateDefaultClassSettings() }
HideCoADB.profiles[charKey] = { classSettings = legacyFlatClassSettings or CreateDefaultClassSettings() }
end
for name, profile in pairs(HideCoADB.profiles) do