fix(storybook): improve speed of storybook plugin#31277
Merged
jaysoo merged 1 commit intonrwl:masterfrom May 22, 2025
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
d9e4b51 to
591d358
Compare
Contributor
Author
|
fyi @leosvelperez |
Contributor
|
View your CI Pipeline Execution ↗ for commit 0403ab6.
☁️ Nx Cloud last updated this comment at |
Bring back old, innacurate, but fast, implementation of getting the storybook framework. Use it preferentially, and fall back to the new one if it fails.
591d358 to
0403ab6
Compare
leosvelperez
approved these changes
May 22, 2025
Member
leosvelperez
left a comment
There was a problem hiding this comment.
Thanks @comp615! Good catch! This makes total sense.
jaysoo
approved these changes
May 22, 2025
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
#22953 updated the way that storybook parsing works to always do full TS tree resolution instead of AST parsing. While this is more accurate, it's orders of magnitude slower...creating a bottleneck in graph creation for larger repos which use the plugin.
The only reason we need to do this complex functionality is to determine if we use angular or not.
Expected Behavior
Graph creation should be quite fast.
This PR returns the old behavior, and uses the new behavior as an additive fallback. In most cases this will result in extremely fast parsing when the framework is defined inline, and in the failure case, it will result in unnoticeably slower parsing as the incremental difference is minor.
Before:
After:
An alternative solve (at least in our case) would be to add an option to skip angular detection...essentially letting people bypass the whole reason for doing this config parsing. Although that's probably not a sustainable option.
NOTE: A majority of the remaining slowness in this plugin is spent hashing the files for the target cache. If we wanted to, we could further speed this up by making some assumptions there...but that may drastically harm repos which rely on the fully resolution behavior
Related Issue(s)
Fixes #31276