fix(examples): guard missing #app mount target in svelte simple example#10144
fix(examples): guard missing #app mount target in svelte simple example#10144grzdev wants to merge 1 commit intoTanStack:mainfrom
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughThe change refactors error handling in a Svelte mount call by replacing a TypeScript non-null assertion with an explicit DOM query and runtime error check. The code now retrieves the target element, validates its existence, and throws an error if missing before passing it to the mount function. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 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)
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 |
What
Adds a safety guard for the Svelte
simpleexample mount target.Why
The example previously used a non-null assertion:
document.querySelector('#app')!
If the DOM element is missing or renamed, the example crashes at runtime. Since examples are frequently copied, adding a guard improves reliability and developer experience.
Changes
#appelementScope
Example-only change. No package/runtime changes.
Summary by CodeRabbit