fix: added adapter to fix the SSR Icon missing error - #527
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe runtime plugin now configures Iconify with a request-aware fetch chain and uses it for custom icon loading. A Nuxt SSR fixture renders the Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
commit: |
🔗 Linked issue
Resolves #518.
📚 Description
After updating the
nuxt/iconup from@2.3.1the icons fail to render if app uses SSR. For ex:Related issue describes the core regression correctly.
Solution
The simple priority logic to pick correcrt
fetchwas added to resolve both initial issue #514 (where regression appeared) and remove that regression.Here's the logic behind the prioritization:
event.fetchif it is available as the most "context-rich": relative Nitro routes, preserving request’s headers and context, base URL, etc.useRequestFetch().nativeif it is available. Used in browser (or future Nuxt 5) and keeping fix by fix: avoid relying on global fetch #514.Here's the regression, as Nuxt 4/Nitro 2
useRequestFetch()doesn't expose.native.globalThis.$fetch.nativeas the Nuxt 4/Nitro 2 SSR compatibility path.globalThis.fetchas the final safety net.I also added fixture, expanded smoke and wrote regression tests.