From 23dd4fa4308c91abef13e8e23876ab12ea79db2e Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Tue, 3 Dec 2024 20:35:27 +0000 Subject: [PATCH] remove redundant code from action-bar-element (#3216) Co-authored-by: AdamShwert Co-authored-by: Alon Dahari Co-authored-by: Arelia Jones <2359538+arelia@users.noreply.github.com> Co-authored-by: Cam McHenry Co-authored-by: Chris Maynard Co-authored-by: Cody Bodfield Co-authored-by: Dusty Greif Co-authored-by: Jibran Garcia Co-authored-by: Marie Lucca <40550942+francinelucca@users.noreply.github.com> Co-authored-by: Cameron Dutro Co-authored-by: Jon Rohan --- .changeset/weak-birds-unite.md | 5 +++++ app/components/primer/alpha/action_bar_element.ts | 8 -------- 2 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 .changeset/weak-birds-unite.md diff --git a/.changeset/weak-birds-unite.md b/.changeset/weak-birds-unite.md new file mode 100644 index 0000000000..34740cb2de --- /dev/null +++ b/.changeset/weak-birds-unite.md @@ -0,0 +1,5 @@ +--- +'@primer/view-components': patch +--- + +Remove redundant code for better performance. diff --git a/app/components/primer/alpha/action_bar_element.ts b/app/components/primer/alpha/action_bar_element.ts index d5d76f7ad0..e59e722c44 100644 --- a/app/components/primer/alpha/action_bar_element.ts +++ b/app/components/primer/alpha/action_bar_element.ts @@ -36,14 +36,6 @@ class ActionBarElement extends HTMLElement { #focusZoneAbortController: AbortController | null = null connectedCallback() { - // Calculate the width of all the items before hiding anything - for (const item of this.items) { - const width = item.getBoundingClientRect().width - const marginLeft = parseInt(window.getComputedStyle(item)?.marginLeft, 10) - const marginRight = parseInt(window.getComputedStyle(item)?.marginRight, 10) - item.setAttribute('data-offset-width', `${width + marginLeft + marginRight}`) - } - resizeObserver.observe(this) instersectionObserver.observe(this)