-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
HTML Search: Fix multiple term matching edge case #11960
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
Conversation
Two nitpicks with the test case:
|
Done! For future reference if you have suggestions using GitHub's "suggest" feature in a comment on the diff is a little easier for me to apply -- see step 6 here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me 👍
I've been fairly cautious about reviewing these search changes because I'd like to understand them in some detail. This one still looks good to me. One minor suggestion that I have -- frustratingly, GitHub doesn't allow suggestions on line ranges that include unmodified lines, it seems -- would be to aim for consistency with the creation of if (!fileMap.has(file)) fileMap.set(file, [word]);
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); ...however: that's optional, and again I think this pull request is in good shape. |
In JavaScript it's generally considered best practice to always use curly braces in a conditional clause: https://eslint.org/docs/latest/rules/curly -- especially when there's an else involved. That said, this would be consistent with the style elsewhere in this file. I guess I'll change it, this PR needs a changelog entry anyway. |
2528b80
to
8b993fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @wlach 👍
8b993fa
to
b3cb007
Compare
b3cb007
to
8b800da
Compare
@jayaddison @picnixz Ok I rebased this on top of master / #11958 so I think it's ready to go in too. |
I think it's fine. It'll be the last PR that I'll review for the next 10 days (I'm travelling). Thank you. If there is some critical things to do next week, ping me or chrisjsewell or jfbu which have write permissions. |
No problem, I'll probably just wait for you/others to take a look at the remaining work on their own schedule. If it's been a while I will ping. |
Subject: Fix multiple term matching edge case
Feature or Bugfix
Purpose
Fixes multiple matches getting accidentally overwritten in certain rare cases
Detail
In certain rare cases, term matches could get overwritten due to a logic bug in the search code. Fix this and add a test.
Relates
Closes #11959