Skip to content

feat(stories): Lazy load story API type docs#110332

Merged
scttcper merged 4 commits intomasterfrom
scttcper/lazy-type-docs
Mar 11, 2026
Merged

feat(stories): Lazy load story API type docs#110332
scttcper merged 4 commits intomasterfrom
scttcper/lazy-type-docs

Conversation

@scttcper
Copy link
Member

@scttcper scttcper commented Mar 10, 2026

Load story type documentation lazily from MDX exports and resolve it only when opening the API tab, saves the expensive compile time for when requested rather than startup.

Remove CODECOV_ENABLE_BA - unused
Remove STORYBOOK_TYPES - now just disabled for acceptance tests. dev-ui-storybook essentially the same.

fixes DE-374

Load story type documentation lazily from MDX exports and resolve it only when opening the API tab.

Made-with: Cursor
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 10, 2026
Replace arrow-function documentation exports with bare dynamic imports
and handle module.default unwrapping in the consuming hook. Remove the
noop type-loader since rspack lazy compilation now defers the expensive
TS compiler work until the docs are actually requested.

- MDX files export `documentation = import('!!type-loader!...')`
- Remove StoryDocumentationExport union type and isStoryDocumentationLoader
- Remove isLoadingDocumentation prop threading
- Remove noop type-loader, always run prod loader
- Enable rspack lazy compilation for type-loader modules via test filter

Co-Authored-By: Cursor <noreply@cursor.com>
Made-with: Cursor
@scttcper scttcper marked this pull request as ready for review March 10, 2026 20:16
@scttcper scttcper requested review from a team as code owners March 10, 2026 20:16
Convert all .stories.tsx files from static imports
(`import documentation from '!!type-loader!...'`) to lazy dynamic
imports (`export const documentation = import('!!type-loader!...')`),
matching the pattern already used in .mdx files.

Update storyExports.tsx to resolve documentation for TSX stories too,
so API reference docs continue to render.

Co-Authored-By: Cursor <noreply@cursor.com>
Made-with: Cursor
@JonasBa
Copy link
Member

JonasBa commented Mar 10, 2026

Thank you @scttcper!

This fixes DE-374

@linear-code
Copy link

linear-code bot commented Mar 11, 2026

@scttcper scttcper merged commit 2875b97 into master Mar 11, 2026
63 checks passed
@scttcper scttcper deleted the scttcper/lazy-type-docs branch March 11, 2026 16:54
scttcper added a commit that referenced this pull request Mar 11, 2026
Require type-loader imports to use dynamic import so type docs are lazy
loaded instead of resolved at module load time.

enforces that we don't regress from after enabling lazy loaded types in
#110332

Co-authored-by: Cursor <cursoragent@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants