Skip to content
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

Avoid slow regex.match call in renderJsx #15581

Merged
merged 1 commit into from Jul 16, 2021

Conversation

maerten
Copy link
Contributor

@maerten maerten commented Jul 14, 2021

Issue:

What I did

Added: a faster indexOf check to see if a slower regex match can be avoided.

The regex can cause slow renders if images are passed in base64 encoded format. The regex will then attempt to find the string 'quot&' in the entire base64 string.

How to test

This should not impact behavior, other than performance.
Storybook > Docs > Show Code should now be a little faster when passing long base64 strings as props.

@nx-cloud
Copy link

nx-cloud bot commented Jul 14, 2021

Nx Cloud Report

CI ran the following commands for commit f001b11. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

@maerten maerten changed the title Avoid potentially slow regex call in renderJsx Avoid slow regex.match call in renderJsx Jul 14, 2021
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM!! Thanks @maerten 💯

@shilman shilman merged commit 12c6e95 into storybookjs:next Jul 16, 2021
@shilman shilman added this to the 6.4 PRs milestone Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants