From 9a187eee135ed8d35a134fd10d457c8e2626922b Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 04:07:20 +0000 Subject: [PATCH 1/2] fix: apply CodeRabbit auto-fixes Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit --- entrypoints/content/index.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/entrypoints/content/index.ts b/entrypoints/content/index.ts index 79c39f2..3e6d777 100644 --- a/entrypoints/content/index.ts +++ b/entrypoints/content/index.ts @@ -862,9 +862,19 @@ function injectIcon(input: EmailInputElement) { return; } + let iconContainer: HTMLDivElement | undefined; + let state: + | { + inputResizeObserver: ResizeObserver | undefined; + activePopup: HTMLElement | null; + iconPlacementDirection: "left" | "right" | "above" | "below" | null; + positionIconOutsideInput: () => void; + } + | undefined; + try { // Create icon container (no wrapping, just for the icon) - const iconContainer = document.createElement("div"); + iconContainer = document.createElement("div"); iconContainer.className = "gmail-alias-input-icon-container"; iconContainer.innerHTML = ICON_HTML; @@ -941,7 +951,7 @@ function injectIcon(input: EmailInputElement) { ); }; - const state = { + state = { inputResizeObserver: undefined as ResizeObserver | undefined, activePopup: null as HTMLElement | null, iconPlacementDirection: null as @@ -1353,13 +1363,15 @@ function injectIcon(input: EmailInputElement) { input.__gmailAliasIcon = icon as unknown as HTMLElement; } catch { // Clean up partial initialization to prevent duplicate injection - iconContainer.remove(); + iconContainer?.remove(); input.__gmailAliasIcon = undefined; input.__gmailAliasPosition = undefined; input.__gmailAliasCleanup = undefined; - state.inputResizeObserver?.disconnect(); - window.removeEventListener("resize", state.positionIconOutsideInput); - window.removeEventListener("scroll", state.positionIconOutsideInput, true); + if (state) { + state.inputResizeObserver?.disconnect(); + window.removeEventListener("resize", state.positionIconOutsideInput); + window.removeEventListener("scroll", state.positionIconOutsideInput, true); + } } } From c9e136d68eba1655e02ff66d43c53498976cb704 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 04:07:36 +0000 Subject: [PATCH 2/2] style: format code with Prettier This commit fixes the style issues introduced in 9a187ee according to the output from Prettier. Details: https://github.com/ePlus-DEV/gmail-alias-toolkit/pull/68 --- entrypoints/content/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoints/content/index.ts b/entrypoints/content/index.ts index 3e6d777..2c476d0 100644 --- a/entrypoints/content/index.ts +++ b/entrypoints/content/index.ts @@ -1370,7 +1370,11 @@ function injectIcon(input: EmailInputElement) { if (state) { state.inputResizeObserver?.disconnect(); window.removeEventListener("resize", state.positionIconOutsideInput); - window.removeEventListener("scroll", state.positionIconOutsideInput, true); + window.removeEventListener( + "scroll", + state.positionIconOutsideInput, + true, + ); } } }