From 684cd676e57340a34b0d59cf67ca410320dd20a0 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 4 Jul 2020 15:34:29 -0400 Subject: [PATCH] Delete empty unsubmitted submissions when delete is called --- src/config.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index fb771545..537f4b11 100644 --- a/src/config.ts +++ b/src/config.ts @@ -109,7 +109,15 @@ class SBMap extends Map { delete(key) { const result = super.delete(key); - this.update(); + // Make sure there are no empty elements + for (const entry of this.entries()) { + if (entry[1].length === 0) { + super.delete(entry[0]); + } + } + + this.update(); + return result; }