Skip to content

Arena: stop early GetContentType calls from destroying the reload hint#156

Open
Krathe82 wants to merge 1 commit into
DanderBot:mainfrom
Krathe82:pr/arena-reload-content-hint
Open

Arena: stop early GetContentType calls from destroying the reload hint#156
Krathe82 wants to merge 1 commit into
DanderBot:mainfrom
Krathe82:pr/arena-reload-content-hint

Conversation

@Krathe82

Copy link
Copy Markdown
Contributor

Problem

The existing ARENA RELOAD FIX (trust the saved lastContentType hint while IsInInstance() recovers after a reload) was being defeated by its own neighbours, leaving the arena header hidden after a reload in arena — worst case on a combat reload mid-round, where the frames could stay hidden until the round ended.

Sequence:

  1. On a reload, FinalizeHeaderInitUpdateHeaderVisibility calls GetContentType() at ADDON_LOADED — before PLAYER_ENTERING_WORLD arms useContentTypeFallback.
  2. If WoW's APIs aren't ready yet, that early call either nils DandersFramesCharDB.lastContentType (not-in-raid branch) or overwrites it with "openWorld" (in-raid + instanceType "none" — arena groups are raid groups, and IsInRaid() can recover before IsInInstance()).
  3. By the time PEW arms the fallback, the hint it relies on is gone.

Out of combat, the ArenaDetectionRetry / ARENA_PREP backups recover. Mid-combat they can't (secure Show is blocked), so the one window that can fix it — the combat-safe ADDON_LOADED window the addon already uses for combat reloads — ran with a wrong content type.

Fix

  • Snapshot the hint once at load (DF._contentTypeHintAtLoad, captured in Core's ADDON_LOADED handler plus a self-capture in GetContentType for ordering safety) and read the fallback from the snapshot, so later live-field writes can't destroy it.
  • Arm the fallback at ADDON_LOADED on a /reload (player already exists at ADDON_LOADED only on a reload — same detection the header init uses), so the combat-safe FinalizeHeaderInit window already resolves "arena" and can show the arena header. Fresh logins still never arm it: a stale "arena" hint from a previous session would misclassify the login zone, and the fallback only clears once real detection returns a definite answer.
  • Extend the fallback to the IsInRaid()==true + instanceType "none" case, which previously classified an arena reload as "openWorld" and showed raid frames over the arena header.

No behaviour change outside the reload-recovery window: the first confident IsInInstance()/roster read clears the fallback and resumes normal detection, exactly as before.

Testing

  • Structural syntax check passes; fallback/branch logic traced against all four entry orderings (ADDON_LOADED vs PEW, in/out of combat).
  • /reload in arena prep and mid-round: header visibility + sorting recover via the armed fallback instead of waiting for ArenaDetectionRetry.

The ARENA RELOAD FIX fallback (trust the saved lastContentType hint while
IsInInstance() recovers after a reload) was being defeated by its own
neighbours: on a reload, FinalizeHeaderInit -> UpdateHeaderVisibility calls
GetContentType at ADDON_LOADED -- before PLAYER_ENTERING_WORLD arms
useContentTypeFallback. If WoW's APIs weren't ready yet, that early call
either nil'd DandersFramesCharDB.lastContentType (not-in-raid branch) or
overwrote it with "openWorld" (in-raid + instanceType "none"), destroying
the hint in exactly the scenario it exists for. Out of combat the
ArenaDetectionRetry/ARENA_PREP backups recover; on a combat reload
mid-round the arena frames could stay hidden until the round ended.

- Snapshot the hint once at load (ADDON_LOADED, plus a self-capture in
  GetContentType for safety) and read the fallback from the snapshot, so
  later live-field writes can't destroy it.
- Arm the fallback at ADDON_LOADED on a /reload (player already exists at
  ADDON_LOADED only on a reload -- same detection the header init uses),
  so the combat-safe FinalizeHeaderInit window already benefits. Fresh
  logins still never arm it: a stale "arena" hint from a previous session
  would misclassify the login zone.
- Extend the fallback to the IsInRaid()==true + instanceType "none" case:
  IsInRaid() can recover before IsInInstance() after an arena reload
  (arena groups ARE raid groups), which previously classified the arena
  as "openWorld" and showed raid frames over the arena header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant