From 65dcb96c1db3e32b3d5ce0621f98eeca28e50657 Mon Sep 17 00:00:00 2001 From: Narcasung Date: Wed, 8 Jul 2026 00:30:53 +0200 Subject: [PATCH] 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. --- HideCoA.lua | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/HideCoA.lua b/HideCoA.lua index 2f50bf6..67ae23b 100644 --- a/HideCoA.lua +++ b/HideCoA.lua @@ -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