Skip to content

repo-age - Restore feature - #9888

Merged
fregante merged 3 commits into
refined-github:mainfrom
kang8:bugfix/repo-age-react-sidebar-v2
Jul 28, 2026
Merged

fregante merged 3 commits into
refined-github:mainfrom
kang8:bugfix/repo-age-react-sidebar-v2

Conversation

@kang8

@kang8 kang8 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #9886

GitHub replaced the repo sidebar with a React version and .BorderGrid no longer
exists on the page, so elementReady('.BorderGrid .octicon-repo-forked') resolved
to undefined and closestElement threw "base element is null or undefined".

Re-scoping the lookup to the new pane isn't enough: the icon is already present at
DOMContentLoaded, but React replaces the whole pane subtree during hydration and
discards the element we inserted. Using the selector observer re-adds the age when
the replacement icon appears.

Tested with an unpacked build in a throwaway Chromium profile (logged out, seeded
first-commit cache):

Scenario .BorderGrid (before) selector-only fix this PR
Hard load ❌ ❌ ✅
Reload ❌ ❌ ✅
/tree/6619 ❌ ❌ ✅
5× reload 5/5 missing 1/5 missing no misses, no duplicates
Soft navigation 0/3 0/5 5/5

Not covered: logged-in state, empty repos, forks, narrow viewports.

GitHub replaced the repo sidebar with a React version and `.BorderGrid`
no longer exists on the page, so `elementReady('.BorderGrid
.octicon-repo-forked')` resolved to `undefined` and `closestElement`
threw "base element is null or undefined".

Re-scoping the lookup to the new pane isn't enough: the icon is already
present at DOMContentLoaded, but React replaces the whole pane subtree
during hydration and discards the element we inserted. Use the selector
observer so the age is re-added when the replacement icon appears.

Fixes refined-github#9886
@github-actions github-actions Bot added the bug label Jul 27, 2026
The feature fetches the first commit through the GraphQL API, so it must
wait for a personal token like the other `api.v4` features do; otherwise
`init` fails midway on token-less installs.

`deduplicate: 'has-rgh-inner'` is deprecated (refined-github#5871) and no longer needed:
the selector observer now handles re-insertion after soft navigations and
React hydration.
@fregante

Copy link
Copy Markdown
Member

Thank you!

@fregante fregante changed the title repo-age - Support latest sidebar layout repo-age - Restore feature Jul 28, 2026
@fregante
fregante merged commit d772510 into refined-github:main Jul 28, 2026
11 of 13 checks passed
@SmartManoj

SmartManoj commented Aug 5, 2026 •

Copy link
Copy Markdown

Any chance of a release? repo-age is silently broken for everyone on 26.7.26, and the fix has been on main since the 28th.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

repo-age: Expected closest element not found: base element is null or undefined

3 participants