From 0eca80958979b0e0ba4d49548748c27d53604e3c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 6 Jun 2026 23:37:17 +0200 Subject: [PATCH] Shorten the `DrawLayerBuilder.prototype.cancel` method a tiny bit By replacing the early return with optional chaining, a pattern that we already use in lots of places, the code becomes a tiny bit shorter and more importantly the code coverage for this file becomes 100 percent. --- web/draw_layer_builder.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/web/draw_layer_builder.js b/web/draw_layer_builder.js index ae2c93356..1de5bd59b 100644 --- a/web/draw_layer_builder.js +++ b/web/draw_layer_builder.js @@ -68,10 +68,7 @@ class DrawLayerBuilder { cancel() { this._cancelled = true; - if (!this.#drawLayer) { - return; - } - this.#drawLayer.destroy(); + this.#drawLayer?.destroy(); this.#drawLayer = null; }