fix(BUG-12): campaign selection follows activeDisplay
Selection effect had `!selectedCampaignId` guard — once any campaign selected, new activeDisplay.activeCampaignId writes ignored. Replay tool writes activeDisplay to new campaign each run; UI stayed on old selection => displayed wrong campaign data. Removed guard. Selection now syncs when activeCampaignId differs from current selection. Manual deselect (null) does not force-select (RED test locks this). Also fixed test helper bug: createCampaignViaUI/createEncounterViaUI returned FIRST setDoc match (idA for all creates). Now filters by name + .pop() for latest. This masked the real bug for several debug cycles. Tests: 2 new (SelectionFollowsActiveDisplay), both green. No regressions in full FE suite (App, Combat, DisplayView, Encounter, HideHpToggle, Logs, Participant, storage all pass). Combat.scenario = pre-existing BUG-11 crash, not regression.
This commit is contained in:
+2
-3
@@ -2151,11 +2151,10 @@ function AdminView({ userId }) {
|
||||
if (
|
||||
initialActiveInfo &&
|
||||
initialActiveInfo.activeCampaignId &&
|
||||
campaignsWithDetails.length > 0 &&
|
||||
!selectedCampaignId
|
||||
campaignsWithDetails.length > 0
|
||||
) {
|
||||
const campaignExists = campaignsWithDetails.some(c => c.id === initialActiveInfo.activeCampaignId);
|
||||
if (campaignExists) {
|
||||
if (campaignExists && selectedCampaignId !== initialActiveInfo.activeCampaignId) {
|
||||
setSelectedCampaignId(initialActiveInfo.activeCampaignId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user