Upgrade @spree/sdk to 1.1.0#160
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 52 minutes and 59 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughBumps ChangesSDK v1.1 Adaptation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/products/ProductCustomFields.tsx (1)
19-31:⚠️ Potential issue | 🟠 MajorAdd handlers for SDK 1.1.0 field types:
short_text,long_text, andnumber.The switch statement handles only
"boolean","json", and"rich_text", but Spree SDK 1.1.0 definesCustomField.field_typeas'short_text' | 'long_text' | 'rich_text' | 'number' | 'boolean' | 'json'. The missing cases fall through to the default handler, which may not be optimal for these types. Add explicit cases forshort_text,long_text, andnumberto ensure proper rendering:Current incomplete switch
switch (field.field_type) { case "boolean": return renderBooleanValue(field.value, t); case "json": return typeof field.value === "string" ? field.value : JSON.stringify(field.value); case "rich_text": // Value is admin-authored HTML from the Spree CMS backend (trusted source) return <span dangerouslySetInnerHTML={{ __html: field.value }} />; default: return String(field.value); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/products/ProductCustomFields.tsx` around lines 19 - 31, The switch statement in the ProductCustomFields component is missing handlers for three field types defined in Spree SDK 1.1.0: short_text, long_text, and number. These types currently fall through to the default case. Add explicit case handlers for short_text, long_text, and number in the switch statement that follows the rich_text case and before the default case. For short_text and long_text, return String(field.value) to convert the value to a string. For number, also return String(field.value) to ensure consistent string representation. This ensures all SDK 1.1.0 field types are explicitly handled rather than relying on the default case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/products/ProductCustomFields.tsx`:
- Around line 26-28: In the rich_text case of the switch statement in
ProductCustomFields.tsx, the field.value passed to dangerouslySetInnerHTML can
be undefined or null, which will cause the literal strings "undefined" or "null"
to render. Guard against this by providing a fallback to an empty string when
field.value is nullish. Update the __html property to use field.value with a
nullish coalescing operator or conditional to ensure an empty string is used
instead of undefined or null.
---
Outside diff comments:
In `@src/components/products/ProductCustomFields.tsx`:
- Around line 19-31: The switch statement in the ProductCustomFields component
is missing handlers for three field types defined in Spree SDK 1.1.0:
short_text, long_text, and number. These types currently fall through to the
default case. Add explicit case handlers for short_text, long_text, and number
in the switch statement that follows the rich_text case and before the default
case. For short_text and long_text, return String(field.value) to convert the
value to a string. For number, also return String(field.value) to ensure
consistent string representation. This ensures all SDK 1.1.0 field types are
explicitly handled rather than relying on the default case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 28542d17-6415-4902-8eff-880ca50b9bf1
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.jsonsrc/components/products/ProductCustomFields.tsxsrc/lib/metadata/product.ts
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
@spree/sdkfrom^1.0.0to^1.1.0(resolves to 1.1.0).ProductCustomFieldsfrom the deprecatedCustomField.type(Ruby STI class name) to the newfield_typetoken (boolean,json,rich_text, etc.).product.meta_titlefor product page SEO metadata, falling back toproduct.namewhen unset — matching the existing category metadata pattern.Test plan
<title>and Open Graph title usemeta_titlewhen set in Spree admin.meta_titlestill use the product name.npm run checkandnpx tsc --noEmit.Summary by CodeRabbit
Chores
Improvements