Skip to content

Fix duplicate React in Ladle workspace stories - #1153

Merged
ymichael merged 1 commit into
mainfrom
bb/investigate-getbb-app-loading-error-thr_bc7d5mf63k
Aug 7, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/investigate-getbb-app-loading-error-thr_bc7d5mf63k

Conversation

@ymichael

@ymichael ymichael commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • deduplicate React and React DOM in the Ladle Vite resolver
  • keep linked workspace stories on the same React module instance as the Ladle renderer
  • prevent invalid hook calls when Vite refreshes its optimized dependency graph

Verification

  • pnpm exec turbo run typecheck --filter=@bb/app
  • pnpm exec turbo run test --filter=@bb/app --force (321 files, 2,402 tests)
  • pnpm exec turbo run lint --filter=@bb/app (passes with existing warnings)
  • confirmed the affected story, StoryRow, and renderer resolve through one optimized React graph

@SawyerHood

Copy link
Copy Markdown
Collaborator

🚨 SLOP COP 🚨 · review

I am SlopCop. I am now reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

ELI5: Ladle could load two React copies. This change makes Ladle use one copy, so React hooks work correctly.

Result: I found no blocking issues.

  • Security: The fixed package list adds no input, network, secret, path, or code execution risk.
  • Code quality: Vite supports this focused dedupe rule. The comment explains the failure and the reason for the fix.
  • Architecture: The codebase has no other React dedupe rule. A shared helper would add coupling without removing useful duplication.
  • Performance: The first start refreshes the Vite cache. Later starts can reuse it. One React copy can reduce work and memory.
  • End-to-end: I started Ladle from this exact SHA. The linked Automations workspace story loaded with no console error or page error.

One non-blocking follow-up remains. The normal app lint and Node type checks do not include .ladle/vite.config.ts. Turbo also has no storybook:build task. Consider adding Ladle configuration validation to the automated checks.

Validation passed for git diff --check, the Turbo app type check, and a full Ladle production build. The browser used one Ladle React prebundle path. All completed GitHub checks pass. One macOS package check still runs.

@ymichael
ymichael merged commit 751ab62 into main Aug 7, 2026
10 checks passed
@ymichael
ymichael deleted the bb/investigate-getbb-app-loading-error-thr_bc7d5mf63k branch August 7, 2026 18:34
amadad pushed a commit to amadad/bb that referenced this pull request Aug 14, 2026
## Summary

- deduplicate React and React DOM in the Ladle Vite resolver
- keep linked workspace stories on the same React module instance as the
Ladle renderer
- prevent invalid hook calls when Vite refreshes its optimized
dependency graph

## Verification

- pnpm exec turbo run typecheck --filter=@bb/app
- pnpm exec turbo run test --filter=@bb/app --force (321 files, 2,402
tests)
- pnpm exec turbo run lint --filter=@bb/app (passes with existing
warnings)
- confirmed the affected story, StoryRow, and renderer resolve through
one optimized React graph
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.

2 participants