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 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

LGTM!! Thanks @maerten 💯

@shilman shilman merged commit 12c6e95 into storybookjs:next Jul 16, 2021
42 of 45 checks passed
42 of 45 checks passed
@github-actions
Run workflow with all e2e tests
Details
@github-actions
Run workflow with all e2e tests
Details
@github-actions
Run workflow with all e2e tests
Details
@github-actions
Run workflow with all e2e tests
Details
@github-actions
Danger JS
Details
@github-actions
Danger JS
Details
@github-actions
Danger JS
Details
@github-actions
Danger JS
Details
ci/circleci: e2e-tests-pnp Your tests failed on CircleCI
Details
@circleci-checks
test Workflow: test
Details
@storybook-bot
UI Tests (regression-test-angular) Build 10387 has 5 changes that must be accepted
Details
@netlify
Pages changed 44 new files uploaded
Details
@netlify
Redirect rules No redirect rules processed
Details
DeepScan 0 new and 0 fixed issues
Details
@netlify
Header rules 1 header rule processed
Details
@netlify
Mixed content No mixed content detected
Details
@nx-cloud
NxCloud Your NxCloud report is now available
Details
Storybook Publish 536 stories published.
Details
UI Tests 536 tests unchanged.
Details
@storybook-bot
UI Tests (regression-test-cra15) Build 9009 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-crakitchensink) Build 9146 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-cratsessentials) Build 8912 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-cratskitchensink) Build 15473 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-ember) Build 8926 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-html) Build 8913 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-preact) Build 8814 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-svelte) Build 8847 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-vue) Build 8842 passed unchanged.
Details
@storybook-bot
UI Tests (regression-test-webcomponents) Build 8734 passed unchanged.
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: chromatic Your tests passed on CircleCI!
Details
ci/circleci: coverage Your tests passed on CircleCI!
Details
ci/circleci: cra-bench Your tests passed on CircleCI!
Details
ci/circleci: e2e-tests-core Your tests passed on CircleCI!
Details
ci/circleci: e2e-tests-examples Your tests passed on CircleCI!
Details
ci/circleci: e2e-tests-extended Your tests passed on CircleCI!
Details
ci/circleci: examples Your tests passed on CircleCI!
Details
ci/circleci: frontpage Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: packtracker Your tests passed on CircleCI!
Details
ci/circleci: publish Your tests passed on CircleCI!
Details
ci/circleci: smoke-tests Your tests passed on CircleCI!
Details
ci/circleci: unit-tests Your tests passed on CircleCI!
Details
@circleci-checks
deploy Workflow: deploy
Details
@netlify
deploy/netlify Deploy Preview ready!
Details
@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
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants