payload icon indicating copy to clipboard operation
payload copied to clipboard

Safari, @payloadcms/richtext-lexical, Invalid regular expression: invalid group specifier name

Open matt-sweda-calder opened this issue 1 year ago • 6 comments

Link to reproduction

No response

Payload Version

3.0.0-beta.59

Node Version

v21.6.2

Next.js Version

15.0.0-canary.68

Describe the Bug

Screen Shot 2024-07-19 at 11 49 20 AM

Because of the regex at: https://github.com/payloadcms/payload/blob/18645771c86664f1246f0fb599c8265a4cd1d6c0/packages/richtext-lexical/src/field/features/Link/plugins/autoLink/index.tsx#L416

...some pages are broken on safari and script execution stops, it seems to be related to this ongoing safari bug: https://stackoverflow.com/questions/51568821/works-in-chrome-but-breaks-in-safari-invalid-regular-expression-invalid-group

Reproduction Steps

I setup a Payload/NextJS app using the richtext lexical editor. When I visit a page that fetches and displays rich text data, the safari console shows the error in the screenshot above.

Adapters and Plugins

No response

matt-sweda-calder avatar Jul 19 '24 16:07 matt-sweda-calder

I guess I'm not sure whether the issue is because of the URL_REGEX or the EMAIL_REGEX.

matt-sweda-calder avatar Jul 19 '24 16:07 matt-sweda-calder

I'm using Safari Version 15.6 (17613.3.9.1.5)

matt-sweda-calder avatar Jul 19 '24 16:07 matt-sweda-calder

Tried on beta.67 and it is still an issue

matt-sweda-calder avatar Jul 19 '24 16:07 matt-sweda-calder

Also worth adding, I'm seeing this in a local dev environment. EDIT: it still exists in prod, but it doesn't stop script execution, instead it just shows an unhandled promise error in the console.

matt-sweda-calder avatar Jul 19 '24 17:07 matt-sweda-calder

Tried on beta.98 and it is still an issue. Admin panel is inaccessible.

sarbazx avatar Sep 08 '24 12:09 sarbazx

This issue has been marked as stale due to lack of activity.

To keep this issue open, please indicate that it is still relevant in a comment below.

github-actions[bot] avatar Dec 13 '24 05:12 github-actions[bot]

This issue was automatically closed due to lack of activity.

github-actions[bot] avatar Dec 21 '24 05:12 github-actions[bot]

This issue should be fixed in Safari 16.4 or later: https://caniuse.com/js-regexp-lookbehind

Closing this issue, as I think it's reasonable to expect users to be able to upgrade to these versions

AlessioGr avatar Jan 10 '25 22:01 AlessioGr

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Jan 12 '25 04:01 github-actions[bot]