Skip to content

Incomplete rendering on Safari due to regex incompatibility #2107

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

Closed
decisivewaffles opened this issue May 22, 2022 · 2 comments
Closed

Incomplete rendering on Safari due to regex incompatibility #2107

decisivewaffles opened this issue May 22, 2022 · 2 comments
Assignees

Comments

@decisivewaffles
Copy link

Description

Due to an incompatible regular expression, Safari does not complete rendering of this site.

The dev console shows this error: SyntaxError: Invalid regular expression: invalid group specifier name

This is the regex causing the issue: /(?<={).*?(?=})/g

The issue is that lookbehind assertions are not supported in Safari (or IE):
https://caniuse.com/js-regexp-lookbehind
(Hence the error as it tries to parse the named capture and finds no closing bracket)

This is the only lookbehind assertion I found in this codebase, and it comes from a recent commit to client/app/libs/i18n/index.js

If the assertions are removed but the brackets remain in the regex, I think the string interpolation can be removed in the first usage and a simple .slice(1,-1) would remove them from the second. That said, I'm not familiar enough with this codebase to test that change easily, so not planning to put in a PR.

Reproduction Steps

Using Safari 14.1.1 on Mac or Safari for iOS 15.4, open any page on the site. Note that many page components do not load, including the top bar and and all forms needed to create an account and sign in.

@welcome
Copy link

welcome bot commented May 22, 2022

Thank you for opening this issue with us! If you haven't already, please follow these next steps to officially join our contributor community.

@julianguyen
Copy link
Member

Thanks so much for reporting this bug @decisivewaffles! Just made a pull request to fix the issue!

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

No branches or pull requests

2 participants