Skip to content

Upgrade @spree/sdk to 1.1.0#160

Merged
damianlegawiec merged 3 commits into
mainfrom
cursor/upgrade-spree-sdk-1.1
Jun 16, 2026
Merged

Upgrade @spree/sdk to 1.1.0#160
damianlegawiec merged 3 commits into
mainfrom
cursor/upgrade-spree-sdk-1.1

Conversation

@damianlegawiec

@damianlegawiec damianlegawiec commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Bump @spree/sdk from ^1.0.0 to ^1.1.0 (resolves to 1.1.0).
  • Migrate ProductCustomFields from the deprecated CustomField.type (Ruby STI class name) to the new field_type token (boolean, json, rich_text, etc.).
  • Use product.meta_title for product page SEO metadata, falling back to product.name when unset — matching the existing category metadata pattern.

Test plan

  • Confirm product pages render custom fields correctly (boolean, JSON, rich text, plain text).
  • Verify product page <title> and Open Graph title use meta_title when set in Spree admin.
  • Verify product pages without meta_title still use the product name.
  • Run npm run check and npx tsc --noEmit.

Summary by CodeRabbit

  • Chores

    • Updated SDK dependency to version 1.1.0
  • Improvements

    • Enhanced custom product field rendering for better display accuracy and consistency
    • Improved product page titles to prioritize custom meta titles for better SEO control

damianlegawiec and others added 2 commits June 16, 2026 22:15
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
storefront Ready Ready Preview, Comment Jun 16, 2026 8:36pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@damianlegawiec, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc0d0049-152b-4e20-9378-6b999171094c

📥 Commits

Reviewing files that changed from the base of the PR and between 225bbb6 and 0474b7b.

📒 Files selected for processing (1)
  • src/components/products/ProductCustomFields.tsx

Walkthrough

Bumps @spree/sdk from ^1.0.0 to ^1.1.0. Adapts ProductCustomFields to switch on field.field_type directly with lowercase keys, removing the normalizeType helper. Updates generateProductMetadata to prefer product.meta_title over product.name for the page title.

Changes

SDK v1.1 Adaptation

Layer / File(s) Summary
SDK bump and ProductCustomFields field_type adaptation
package.json, src/components/products/ProductCustomFields.tsx
Bumps @spree/sdk to ^1.1.0. Removes normalizeType helper and updates renderValue to switch on field.field_type using lowercase keys ("boolean", "json", "rich_text"). customFields.map calls renderValue(field, t) directly without per-field type normalization.
Product metadata title preference
src/lib/metadata/product.ts
generateProductMetadata now derives title as product.meta_title ?? product.name.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • spree/storefront#117: Also bumps @spree/sdk in package.json (^0.21.0^1.0.0), the direct predecessor version bump to this PR.
  • spree/storefront#70: Changes @spree/sdk version in package.json, same dependency being updated here.
  • spree/storefront#46: Another @spree/sdk version bump in package.json, part of the same upgrade chain.

Poem

🐇 Hop, hop, the SDK grew to one-point-one,
No more normalizeType — the helper's done!
field_type speaks lowercase, clean and neat,
meta_title leads, with name in retreat.
The bunny updates code and hops away,
A tidy storefront for another day! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: upgrading @spree/sdk from 1.0.0 to 1.1.0, which is the main modification in package.json and the catalyst for the downstream code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/upgrade-spree-sdk-1.1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@damianlegawiec damianlegawiec marked this pull request as ready for review June 16, 2026 20:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟠 Major

Add handlers for SDK 1.1.0 field types: short_text, long_text, and number.

The switch statement handles only "boolean", "json", and "rich_text", but Spree SDK 1.1.0 defines CustomField.field_type as '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 for short_text, long_text, and number to 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

📥 Commits

Reviewing files that changed from the base of the PR and between c990038 and 225bbb6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json
  • src/components/products/ProductCustomFields.tsx
  • src/lib/metadata/product.ts

Comment thread src/components/products/ProductCustomFields.tsx Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
@damianlegawiec damianlegawiec merged commit d900006 into main Jun 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant