Fix party reload permanently writing overrides onto nil raid keys - #1260
Open
dfrisone wants to merge 1 commit into
Open
Fix party reload permanently writing overrides onto nil raid keys#1260dfrisone wants to merge 1 commit into
dfrisone wants to merge 1 commit into
Conversation
ReloadPartyFrames temp-swaps party overrides onto db.profile so the anchor closures that captured it read party values, then restores from a table populated with saved[key] = raw[key]. Assigning nil stores nothing, so a mapped key whose raid value is nil never entered the table, the restore loop skipped it, and the party value stayed on the shared raid key and saved to disk. Keys with a default are immune (NewDB merges defaults into the profile at load, so their raid value is never nil in memory). Nine mapped keys have no default: tooltipMode, debuffIconZoom, defIconZoom, absorbBarPosition, dispelIconBorderSize, and the four borderTexture offset/shift keys. Repro: unsync Extras on the Party tab, set Tooltip Mode to "never" on a profile that never changed the raid value, and the raid frames stop showing tooltips too. Record the swapped keys in a presence list and restore from that, so a nil raid value is written back as nil instead of skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found during review of #1256. Silent, permanent overwrite of raid settings by party overrides, for the nine party-overridable keys that have no stored default.
Cause
ReloadPartyFramestemp-swaps party overrides ontodb.profileso the anchor closures that captured it read party values, then restores afterwards:In Lua, assigning
nilinto a table is a delete, not a store. A mapped key whose raid value isnilnever enterssaved, so the restore loop skips it and the party value stays on the shared raid key, then saves to disk. The reload runs on every party settings change, so one edit is enough.Keys with a default are immune:
NewDBmerges defaults into the profile at load, so their raid value is nevernilin memory. Nine mapped keys have no default:tooltipMode,debuffIconZoom,defIconZoom,absorbBarPosition,dispelIconBorderSize,borderTextureOffset,borderTextureOffsetY,borderTextureShiftX,borderTextureShiftY.Repro on current main: unsync EXTRAS on the Party tab, set party Tooltip Mode to "never" on a profile that never changed the raid value, and raid frames stop showing tooltips, permanently.
Change
Record the swapped keys in a presence list and restore by iterating it, so a
nilraid value is written back asnilinstead of being skipped. Keys with a raid value round-trip exactly as before; this is the only temp-swap site in the module.No migration: the damage is a plain wrong value on a raid key, indistinguishable from a user choice after the fact. Users affected fix it by setting the raid value back once; it then sticks.
Testing
luac -ppasses. An offline round-trip test covers both cases: a defaulted key restores its raid value, a nil-valued key restores tonil(the old loop demonstrably leaves the party value behind).Verified in game: with EXTRAS unsynced, party Tooltip Mode set to "never" no longer touches the raid value; the Frames tab reading and raid tooltips are unchanged, and both values survive a relog.