Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

stop replace all errors #177

Merged
merged 1 commit into from
Jan 25, 2023
Merged

stop replace all errors #177

merged 1 commit into from
Jan 25, 2023

Conversation

tonypls
Copy link

@tonypls tonypls commented Jan 24, 2023

Issue

https://sentry.io/share/issue/c55c9e1c8c304af2a4b54177132c94f4/

Description

Use old school replace instead of replace all for old browser compatibility

Preview

.flatMap((x) =>
x.split(',').map((x) => x.replaceAll('\\', '').replaceAll('"', ''))
)
.flatMap((x) => x.split(',').map((x) => x.replace(/\\/g, '').replace(/"/g, '')))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure this still replaces all instances and not just the first one right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what the /g does :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought so just wanted to make sure. 👍🏼

Copy link
Member

@madsnedergaard madsnedergaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Ideally we should get Vite legacy plugin working so we don't have to think too much about this stuff when developing :)

@tonypls tonypls merged commit eb8dfdf into master Jan 25, 2023
@tonypls tonypls deleted the tvs/fix-replace-all branch January 25, 2023 15:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants