Change OverlayManager.open to always error if the overlay is already active

The old code would allow an overlay to force close *itself*, before immediately re-opening itself, which actually isn't very helpful in practice since that won't re-run any overlay-specific initialization code.
Given how the overlays are being used this really shouldn't have caused any issues, but it's a bug that we should fix nonetheless.
This commit is contained in:
Jonas Jenwald 2022-03-22 09:50:28 +01:00
parent bace0623e5
commit cd133dbcac

View File

@ -80,10 +80,10 @@ class OverlayManager {
if (!this.#overlays[name]) {
throw new Error("The overlay does not exist.");
} else if (this.#active) {
if (this.#overlays[name].canForceClose) {
this.#closeThroughCaller();
} else if (this.#active === name) {
if (this.#active === name) {
throw new Error("The overlay is already active.");
} else if (this.#overlays[name].canForceClose) {
this.#closeThroughCaller();
} else {
throw new Error("Another overlay is currently active.");
}