Repository navigation
feat(unique): use url_matcher capture groups as the unique key - #570
Merged
Merged
Conversation
With a URL matcher like github\.com/.+/issues/(\d+), every issue was a duplicate of every other: the unique key was the url_fragment, which only varies when it holds $n placeholders, and a fragment with $n never matches. When url_matcher has capture groups (and url_fragment no $n), tabs are now duplicates only if they capture the same values. Supersedes the unique_pattern proposal.
📦 Extension Build Ready!Version: 📥 Download Extension (tabee.zip)Installation
Status
🤖 Auto-generated by GitHub Actions |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Merged
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
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.
Closes #507.
Problem
With the sample GitHub Issues rule (
REGEXdetectiongithub\.com/.+/issues/\d+, URL matchergithub\.com/.+/issues/(\d+)), turning on Unique closes every other issue, not just other tabs of the same issue.The unique key was the processed
url_fragment, which only varies when the fragment holds$nplaceholders. But a fragment with$1never matches during detection (see the analysis in #507). So for any rule that actually matches, every tab got the same key.Fix
New
_getUniqueKey(urlFragment, url, urlMatcher)inhelpers.ts, used for both the duplicate comparison and the per-group lock from #558:url_matcherurl_fragmenturl_fragmentwith$nurl_matcherwith capture groupsurl_matcherwithout capture groups, or no matchurl_fragmentThis replaces the
unique_patternproposal with no new field and no UI change;docs/unique-pattern-proposal.mdis marked as superseded. The URL matcher help text in the rule form explains it.Behaviour change
Rules that combine Unique with a
url_matcherthat has capture groups now close fewer tabs: only those with the same captured values, never more. This is what the sample GitHub Issues rule implies, and what the reporter expected.Tests
_getUniqueKey: capture groups,$nfragment, no matcher, no capture group, no match, invalid regex.#issuecommentanchor) is closed; issues 123 / 456 / 789 all stay open. Both fail onmaster.vue-tscand build pass.