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

Storybook stories are incompatible with GraphQL requests #3562

Open
mattlong opened this issue Dec 15, 2023 · 0 comments
Open

Storybook stories are incompatible with GraphQL requests #3562

mattlong opened this issue Dec 15, 2023 · 0 comments
Labels
react Features, fixes and enhancements to react component library

Comments

@mattlong
Copy link
Member

When building storybook, only a subset of resource types listed in packages/generator/src/storybook.ts are loaded to avoid massively bloating the assets loaded when visiting storybook.medplum.com. The way @medplum/fhir-router builds its GQL schema (in buildRootSchema) will almost always be incompatible with having loaded only a subset of types since buildRootSchema crawls through every element of each top-level resource type that was loaded and will pretty quickly hit a type that was not included in that list, e.g. Resource, Extension, oid, etc.

This hasn't been exposed since the common code paths that make GQL queries, e.g. medplum.requestSchema checks if the type has already been loaded and returns early before needing to make the GQL request. Given the tradeoffs of bloating the storybook build bundle size and complexity of recursively loading types, officially not supporting GQL in storybook could very well be a reasonable outcome; if so, an explicit error message should be thrown when a story attempts to do so.

@mattlong mattlong added the react Features, fixes and enhancements to react component library label Dec 15, 2023
@reshmakh reshmakh added this to the Milestone Quality milestone Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react Features, fixes and enhancements to react component library
Projects
Status: No status
Development

No branches or pull requests

2 participants