Skip to content

fix: don't queryselectorall using exact string#3198

Open
stevekaplan123 wants to merge 1 commit intomasterfrom
bug/sc-41507/bug-when-opening-a-link-to-a-commentator-and-it
Open

fix: don't queryselectorall using exact string#3198
stevekaplan123 wants to merge 1 commit intomasterfrom
bug/sc-41507/bug-when-opening-a-link-to-a-commentator-and-it

Conversation

@stevekaplan123
Copy link
Copy Markdown
Contributor

Description

When users open up refs with apostrophes in their titles (like "Kitzur Ba'al HaTurim on Numbers 10:34:1"), we were querying for the title using apostrophes, thus causing a white screen.

Code Changes

Previously, we called querySelectorAll looking for the exact div where 'data-ref' equals "Kitzur Ba'al HaTurim on Numbers 10:34:1" for example. Instead of querying for the exact string, this fix first queries for all TextRange elements and then filters out the one that matches the exact ref we're looking for. We could have solved this by escaping the apostrophes but I think this is more elegant as it doesn't tie us to a specific ref format. We simply grab the elements on the screen with a 'data-ref' (which is not usually more than 10) and look for the one with the exact string match to the ref the user requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants