Skip to content

Fix Storybook build: react-docgen stack overflow in config.ts - #732

Merged
gaidheal1 merged 1 commit into
mainfrom
fix/storybook-docgen-stack-overflow
Aug 9, 2026
Merged

Fix Storybook build: react-docgen stack overflow in config.ts#732
gaidheal1 merged 1 commit into
mainfrom
fix/storybook-docgen-stack-overflow

Conversation

@gaidheal1

Copy link
Copy Markdown
Member

Summary

  • The GitHub Pages docs deploy (deploy-docs.yml) fails at npm run build-storybook with RangeError: Maximum call stack size exceeded inside react-docgen.
  • Root cause: react-docgen's resolveToValue recurses infinitely when a let variable is conditionally assigned and then reassigned again afterward — exactly the pattern API_BASE_URL had in frontend/src/config.ts.
  • Fix: compute API_BASE_URL once via a helper function returning a const, removing the reassignment chain that trips up docgen. No behavior change.

Test plan

  • npm run build-storybook completes successfully locally (previously failed with the stack overflow)
  • frontend/src/config.ts logic unchanged (env var → localhost → origin fallback, then strip /api/v1 and trailing slash)

🤖 Generated with Claude Code

react-docgen's resolveToValue recurses infinitely on a let variable that
is conditionally assigned and then reassigned multiple times, causing
"Maximum call stack size exceeded" during `npm run build-storybook`.
Compute API_BASE_URL once via a helper instead of reassigning it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gaidheal1
gaidheal1 merged commit 43f5c44 into main Aug 9, 2026
6 checks passed
@gaidheal1
gaidheal1 deleted the fix/storybook-docgen-stack-overflow branch August 9, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant