mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-27 21:54:41 +00:00
Fix ranked 1v1 requeue opening matchmaking (#3925)
Resolves: https://discord.com/channels/1284581928254701718/1502285978121801851/1502285978121801851 ## Description: Replace the requeue button-click workaround with a direct `open-matchmaking` event Keep consuming only the `requeue` URL parameter while preserving other query params and hash https://github.com/user-attachments/assets/7922b4ec-1686-484b-8ce1-b417896ddc44 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri
This commit is contained in:
+17
-23
@@ -791,32 +791,26 @@ class Client {
|
|||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle requeue parameter for ranked matchmaking
|
if (this.consumeRequeueUrl()) {
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
document.dispatchEvent(new CustomEvent("open-matchmaking"));
|
||||||
if (searchParams.has("requeue")) {
|
|
||||||
// Remove only the requeue parameter, preserving other params and hash
|
|
||||||
searchParams.delete("requeue");
|
|
||||||
const newUrl =
|
|
||||||
window.location.pathname +
|
|
||||||
(searchParams.toString() ? "?" + searchParams.toString() : "") +
|
|
||||||
window.location.hash;
|
|
||||||
history.replaceState(null, "", newUrl);
|
|
||||||
// Wait for matchmaking button to be defined, then trigger its click handler.
|
|
||||||
customElements.whenDefined("matchmaking-button").then(() => {
|
|
||||||
const matchmakingButton = document.querySelector(
|
|
||||||
"matchmaking-button button",
|
|
||||||
) as HTMLButtonElement | null;
|
|
||||||
if (matchmakingButton) {
|
|
||||||
matchmakingButton.click();
|
|
||||||
} else {
|
|
||||||
console.warn(
|
|
||||||
"Requeue requested, but matchmaking button not found in DOM.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private consumeRequeueUrl(): boolean {
|
||||||
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
if (!searchParams.has("requeue")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchParams.delete("requeue");
|
||||||
|
const newUrl =
|
||||||
|
window.location.pathname +
|
||||||
|
(searchParams.toString() ? `?${searchParams.toString()}` : "") +
|
||||||
|
window.location.hash;
|
||||||
|
history.replaceState(null, "", newUrl);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private async handleJoinLobby(event: CustomEvent<JoinLobbyEvent>) {
|
private async handleJoinLobby(event: CustomEvent<JoinLobbyEvent>) {
|
||||||
const lobby = event.detail;
|
const lobby = event.detail;
|
||||||
this.mostRecentJoinEvent = event.timeStamp;
|
this.mostRecentJoinEvent = event.timeStamp;
|
||||||
|
|||||||
Reference in New Issue
Block a user