payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
23.1k stars 1.44k forks source link

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

Open matt-sweda-calder opened 1 month ago

matt-sweda-calder commented 1 month ago

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 commented 1 month ago

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

matt-sweda-calder commented 1 month ago

I'm using Safari Version 15.6 (17613.3.9.1.5)

matt-sweda-calder commented 1 month ago

Tried on beta.67 and it is still an issue

matt-sweda-calder commented 1 month ago

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.