From daceb9ad59461ff7d4cc905da8190d003e6ac281 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sun, 29 Mar 2026 03:57:06 +0400 Subject: [PATCH] Cancel the planned submission when pending changes canceled --- .../extension/profiles/TaggingProfilePopup.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/content/components/extension/profiles/TaggingProfilePopup.ts b/src/content/components/extension/profiles/TaggingProfilePopup.ts index 6aa2cc3..d551336 100644 --- a/src/content/components/extension/profiles/TaggingProfilePopup.ts +++ b/src/content/components/extension/profiles/TaggingProfilePopup.ts @@ -185,6 +185,19 @@ export class TaggingProfilePopup extends BaseComponent { this.#isPlanningToSubmit = true; this.#emitter.emit(EVENT_PROFILE_POPUP_STATE_CHANGED, 'waiting'); } + + // Whenever user undoes the change they wanted to do in the popup, it's better to not send the submission and just + // do nothing. + if (!this.#tagsToAdd.size && !this.#tagsToRemove.size && this.#isPlanningToSubmit) { + this.#isPlanningToSubmit = false; + this.#emitter.emit(EVENT_PROFILE_POPUP_STATE_CHANGED, 'ready'); + TaggingProfilePopup.#notifyAboutPendingSubmission(false); + + // Probably shouldn't ever happen, but make sure we cancel any delayed submission. + if (this.#tagsSubmissionTimer) { + clearTimeout(this.#tagsSubmissionTimer); + } + } } #onMouseEnteredArea() {