Fixed 404 on Category pages#120
Conversation
When category.image_url is null (as it is for the Blenders category in the Spree API), the rendered HTML becomes:
```typescript
style="background-image: url(null)"
```
The browser treats url(null) as a relative URL literally named null, which resolves against the current page URL. So on /us/en/c/kitchen/blenders, the browser fires off GET
/us/en/c/kitchen/null. Next.js routes that through the same [...permalink] catch-all, getCategory("kitchen/null") returns 404 → SpreeError: Category not found. The AbortError is the
browser cancelling the same phantom request when the dev page hot-reloads.
Fix
Only set backgroundImage when category.image_url is truthy
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe category page component was updated to conditionally apply the background image style. The Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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 docstrings
🧪 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 |
When category.image_url is null (as it is for the Blenders category in the Spree API), the rendered HTML becomes:
The browser treats url(null) as a relative URL literally named null, which resolves against the current page URL. So on /us/en/c/kitchen/blenders, the browser fires off GET
/us/en/c/kitchen/null. Next.js routes that through the same [...permalink] catch-all, getCategory("kitchen/null") returns 404 → SpreeError: Category not found. The AbortError is the
browser cancelling the same phantom request when the dev page hot-reloads.
Fix
Only set backgroundImage when category.image_url is truthy
Summary by CodeRabbit