fix(examples): guard missing mount targets in solid examples#10205
fix(examples): guard missing mount targets in solid examples#10205TkDodo merged 1 commit intoTanStack:mainfrom
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 51606bb
☁️ Nx Cloud last updated this comment at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughSix Solid.js example files are updated to add explicit null-checking for DOM root elements before rendering. Each replaces unsafe non-null assertions with explicit runtime guards that throw errors if the target element is missing. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
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 Solid example mount targets before calling render() / mount().
Why
Several Solid examples used non-null assertions (!) or as HTMLElement casts on document.getElementById(...).
If the DOM element is missing or renamed, the example crashes at runtime with an unclear error. Since examples are frequently copied, adding explicit runtime guards improves reliability and developer experience.
Similar to #10144 (Svelte simple), this applies the same mount target guard pattern to the Solid examples.
Changes
Replaces getElementById(... )! and as HTMLElement with guarded lookups
Throws clear errors when #root or #app is missing
Passes the verified element into render() / mount()
Scope
Examples-only change. No package/runtime changes.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit