fix(examples): guard missing mount targets in react examples#10226
fix(examples): guard missing mount targets in react examples#10226grzdev wants to merge 1 commit intoTanStack:mainfrom
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 3653802
☁️ Nx Cloud last updated this comment at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFour React example entry files replace TypeScript non-null assertions for the root DOM element with explicit runtime null checks that throw descriptive errors if the element is missing, improving error handling at startup. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎯 Changes
What
Adds safety guards for mount targets in several React examples before calling ReactDOM.createRoot().
Why
These examples previously used unsafe patterns such as:
document.getElementById('root') as HTMLElement
If the DOM element is missing or renamed, the example can crash at runtime with an unclear error. Since examples are frequently copied, adding explicit runtime guards improves reliability and developer experience.
Changes
Scope
Examples-only change. No package/runtime changes.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit