Skip to content

Prevent linkify-code from running multiple times - #4613

Merged
fregante merged 6 commits into
refined-github:mainfrom
kidonng:linkify-code
Jul 28, 2021
Merged

fregante merged 6 commits into
refined-github:mainfrom
kidonng:linkify-code

Conversation

Comment thread source/features/linkify-code.tsx Resolved
@kidonng kidonng changed the title Prevent linkify-codefrom running multiple times Prevent linkify-code from running multiple times Jul 27, 2021
@kidonng

kidonng commented Jul 27, 2021

Copy link
Copy Markdown
Member Author

Explaining the selector changes:

  • .comment-body is dropped because all code inside should also be included in .blob-wrapper

    The .d-block part is from a previous fix but we don't need it anymore

  • .blob-expanded is dropped because it is covered by .blob-wrapper tr

  • We are now using more specific selectors to select tr (.js-blob-wrapper tr and .blob-wrapper tr), because code blocks inside comments are also inside file blocks, but linkifiedURLClass will prevent the linkifying from running twice.

  • We still need the :not(.inline-comments) part for .js-blob-wrapper tr because code blocks inside .inline-comments is already handled by .blob-wrapper tr.

@fregante

fregante commented Jul 27, 2021 •

Copy link
Copy Markdown
Member

Thanks! Could you add a few comments explaining where each selector runs, like

// isSingleFile, isPRFiles review suggestion, etc

@fregante fregante added the bug label Jul 27, 2021
@kidonng

kidonng commented Jul 27, 2021

Copy link
Copy Markdown
Member Author

I don't think it make much sense to list every page there so keep in mind that .js-blob-wrapper is for file blocks, .blob-wrapper for anything else and that's it.

@fregante
fregante merged commit 4a60549 into refined-github:main Jul 28, 2021
@fregante

Copy link
Copy Markdown
Member

Thanks!

image

@kidonng
kidonng deleted the linkify-code branch August 2, 2021 18:47
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.

linkify-code runs multiple times on the same URL

2 participants