-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Meta: Avoid failing silently for DOM searches #8863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
22
commits into
main
Choose a base branch
from
copilot/replace-select-dom-imports
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+40
−52
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Fix duplicate imports and TypeScript errors Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
All select-dom imports now use select-dom/strict.js with proper mappings: - $$ → $$optional (aliased as $$ for minimal changes) - elementExists → $optional - countElements → $$optional().length - lastElement → lastElementOptional (when checking for null) Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace select-dom imports with select-dom/strict
Migrate all select-dom imports to select-dom/strict
Jan 10, 2026
fregante
reviewed
Jan 10, 2026
…order - Reverted actionable-pr-view-file.tsx to use elementExists - Changed batch-mark-files-as-viewed.tsx to use $$ (strict) without aliasing - Restored import order in deep-reblame.tsx Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
- Reverted 42 files to use elementExists from 'select-dom' - Removed all '$$optional as $$' aliasing, using actual function names - Fixed import order in multiple files - Updated all usage to match new import patterns Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Copilot
AI
changed the title
Migrate all select-dom imports to select-dom/strict
Migrate select-dom imports to select-dom/strict (partial)
Jan 10, 2026
fregante
reviewed
Jan 10, 2026
- Reverted clean-repo-tabs.tsx to use countElements (non-strict) - Reverted deep-reblame.tsx to use $$ from non-strict select-dom - Reverted token-validation.tsx to use $$ from non-strict select-dom - Reverted closing-remarks.tsx completely (imports and usage) - Changed $$optional to $$ (strict) in files where elements always exist: - close-out-of-view-modals.tsx - cross-deleted-pr-branches.tsx - hidden-review-comments-indicator.tsx - highest-rated-comment.tsx - no-duplicate-list-update-time.tsx - open-issue-to-latest-comment.tsx - quick-comment-hiding.tsx - release-download-count.tsx - click-all.ts - feature-list.tsx (3 instances) - options.tsx Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
- Changed from non-strict $$ to strict $$ (as intended)
- Moved import to correct position with other external imports (line 3)
- Consolidated imports: {$, $$} from 'select-dom/strict.js'
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
fregante
reviewed
Jan 10, 2026
- closing-remarks.tsx: Changed from non-strict to strict $$ import
- token-validation.tsx: Changed from non-strict to strict $$ import
- Both files now use: import {$, $$} from 'select-dom/strict.js'
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
…exist - Changed line 43 from $$ to $$optional for positiveReactionsSelector - Changed line 95 from $$ to $$optional in selectSum function - Added $$optional to imports - Reactions may not exist on the page, so $$optional is appropriate Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Member
|
(placeholder for issue) |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Selective migration of
select-domimports toselect-dom/strict.jsfor better type safety, while preserving non-strict utilities based on codebase conventions.Changes
Selective import migration (~20 files):
$$→$$from strict (when elements are guaranteed to exist and should throw if not found)$$optionalfrom strict (when elements may not exist, e.g., reactions, optional UI elements)lastElement(selector)→lastElementOptional(selector)(when null-checked)$where non-null assertions (!) were already usedPreserved non-strict utilities:
elementExistsfrom non-strict 'select-dom' (42+ files unchanged)countElementsfrom non-strict 'select-dom' where used$$from non-strict in files where iteration over potentially empty arrays is the expected behavior (deep-reblame only)Code quality fixes:
$$optional as $$)Example
Files retain non-strict imports for
elementExists,countElements, andElementNotFoundError(not exported by strict version). Migration uses:$$where elements are guaranteed to exist (closing-remarks, token-validation, and 11 other files)$$optionalwhere elements may not exist (highest-rated-comment for reactions, etc.)Test URLs
Affects all pages where features use DOM selection. Tested on:
Screenshot
N/A - Internal refactoring with no UI changes
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.