From e0cbaf38ffe8c586633ee5695004d681e63ee80a Mon Sep 17 00:00:00 2001 From: Laura van Helvoort <105433238+liquidely@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:35:08 +0100 Subject: [PATCH] fix(match2): BattleRoyale loading panels in wrong container when there's multiple (#5147) * change queryselectors * lint --- javascript/commons/BattleRoyale.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/javascript/commons/BattleRoyale.js b/javascript/commons/BattleRoyale.js index 3889521081e..7d599b998f0 100644 --- a/javascript/commons/BattleRoyale.js +++ b/javascript/commons/BattleRoyale.js @@ -307,8 +307,11 @@ liquipedia.battleRoyale = { if ( loadTemplate && !this.loadedTabs[ battleRoyaleId ][ matchContentId ] ) { this.callTemplate( battleRoyaleId, matchId, gameId, matchContentId, () => { - this.buildBattleRoyaleMapMatchContents( battleRoyaleId, document.querySelector( - `[data-js-battle-royale-content-id="${ matchContentId }"]` ), true ); + this.buildBattleRoyaleMapMatchContents( + battleRoyaleId, this.battleRoyaleInstances[ battleRoyaleId ].querySelector( + `[data-js-battle-royale-content-id="${ matchContentId }"]` + ), true + ); this.loadedTabs[ battleRoyaleId ][ matchContentId ] = true; this.updateGameTabDisplay( battleRoyaleId, matchContentId, gameTab ); this.makeCollapsibles( battleRoyaleId ); @@ -371,7 +374,10 @@ liquipedia.battleRoyale = { wikitext += `{{ShowSingleGame|id=${ battleRoyaleId }|matchid=${ matchId }|gameidx=${ i }}}`; } - const element = document.querySelector( `[data-js-battle-royale-content-id="${ matchContentId }"]` ); + const element = + this.battleRoyaleInstances[ battleRoyaleId ].querySelector( + `[data-js-battle-royale-content-id="${ matchContentId }"]` + ); mw.loader.using( [ 'mediawiki.api' ] ).then( () => { const api = new mw.Api();