diff --git a/source/features/open-all-conversations.tsx b/source/features/open-all-conversations.tsx index 9ef8c9fff57d..94a27116a800 100644 --- a/source/features/open-all-conversations.tsx +++ b/source/features/open-all-conversations.tsx @@ -10,8 +10,10 @@ import observe from '../helpers/selector-observer.js'; function onButtonClick(): void { const links = $$([ + // Issue list 'a[data-testid="issue-pr-title-link"]', - 'a.h4.js-navigation-open', // TODO: Pre-React selector; Drop in 2026 + // PR list -- TODO: Drop after global and repo PR lists become exclusively React-based + 'a.h4.js-navigation-open', ]); if (links.length > 25) { @@ -20,7 +22,9 @@ function onButtonClick(): void { const selectedLinks = links.filter(link => $closestOptional([ - '.js-issue-row.selected', // TODO: Pre-React selector; Drop in 2026 + // PR list -- TODO: Drop after global and repo PR lists become exclusively React-based + '.js-issue-row.selected', + // Issue list '[aria-label^="Selected"]', ], link), ); @@ -33,19 +37,25 @@ function onButtonClick(): void { void openTabs(urls); } -const multipleConversationsSelector = [ - '.js-issue-row + .js-issue-row', // TODO: Pre-React selector; Drop in 2026 - '[role="list"] > div:nth-child(2) > [class^="IssueRow"]', -] as const; - async function hasMoreThanOneConversation(): Promise { - return Boolean(await elementReady(multipleConversationsSelector, {waitForChildren: false})); + const list = await elementReady( + [ + // Issue list + 'ul[data-listview-component="items-list"]', + // PR list -- TODO: Drop after global and repo PR lists become exclusively React-based + '#js-issues-toolbar ~ div > div', + ], + {stopOnDomReady: false, waitForChildren: false}, + ); + return !pageDetect.isBlank() && list!.childElementCount > 1; } function add(anchor: HTMLElement): void { const isLegacy = $closestOptional('.table-list-header-toggle', anchor); const isSelected = $closestOptional([ - '.table-list-triage', // TODO: Pre-React selector; Drop in 2026 + // PR list -- TODO: Drop after global and repo PR lists become exclusively React-based + '.table-list-triage', + // Issue list '[aria-label="Bulk actions"]', ], anchor); const classes = isLegacy @@ -68,7 +78,9 @@ function add(anchor: HTMLElement): void { async function init(signal: AbortSignal): Promise { observe( [ - '.table-list-header-toggle:not(.states)', // TODO: Pre-React selector; Drop in 2026 + // PR list -- TODO: Drop after global and repo PR lists become exclusively React-based + '.table-list-header-toggle:not(.states)', + // Issue list '[aria-label="Bulk actions"] > :first-child', '[aria-label="Actions"] > :first-child', ], @@ -85,14 +97,6 @@ void features.add(import.meta.url, { include: [ pageDetect.isIssueOrPRList, ], - exclude: [ - pageDetect.isGlobalIssueOrPRList, - ], - init, -}, { - include: [ - pageDetect.isGlobalIssueOrPRList, - ], init, });