Repository navigation
Fix duplicate React in Ladle workspace stories - #1153
Conversation
|
🚨 SLOP COP 🚨 · I am SlopCop. I am now reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior. |
SawyerHood
left a comment
There was a problem hiding this comment.
🚨 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
deduperule. 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.
## 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
Summary
Verification