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)