You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
selector-observer <style> rules pile up on every soft navigation, slowing typing on PR pages #10311
Each time GitHub soft-navigates between PR tabs (Conversation ↔ Files changed), Refined GitHub injects another full set of selector-observer<style> elements (:where(…):not(.rgh-seen-…) { animation: 1ms rgh-selector-observer }). The old ones are never removed. In a tab you keep open, the count grows without limit, and every style recalculation has to match all of them against the whole page.
On a large PR's Files changed view, that shows up as typing lag in comment boxes. Each keystroke triggers a style recalculation, so each one gets slower the longer the tab has been open. A reload fixes it until the next round of navigations.
Measured on the URL below (counting <style> elements containing rgh-selector-observer, and timing a forced style recalc after toggling a class on <body>, median of 7):
State
rgh <style> count
Style recalc
Fresh load of Files changed
52
46 ms
After 1 round trip (Conversation → Files changed)
183
After 3 round trips
362
After 10 round trips
992
232 ms
Each navigation adds about 45 elements. In an ordinary working tab I'd had open for about 40 minutes, there were 162 rgh styles but only 72 distinct ones (one rule had 6 copies). Disabling just the duplicates cut the worst keystroke from 160 ms to 72 ms.
In the console: document.querySelectorAll('style').length, or more specifically [...document.querySelectorAll('style')].filter(s => s.textContent.includes('rgh-selector-observer')).length
Click the Conversation tab, then the Files changed tab (soft navigation, no reload).
Run the count again. It grows by about 45 per navigation and never drops.
Repeat a few times, then type in an inline comment box: input gets visibly laggier.
I'd guess the observer's <style> isn't tied to the feature's abort signal on navigation, or the dedupe key changes between navigations, but I haven't confirmed that in the source.
Extension version
26.10.20
Browser(s) used
Chrome 155.0.8059.85, macOS
Token ⚠️
I set a token in the options page. I understand that some features require a token to work.
Activity