Skip to content

Fix ReferenceError in server actions from type export#8

Merged
damianlegawiec merged 2 commits intomainfrom
damianlegawiec/fix-address-params
Feb 11, 2026
Merged

Fix ReferenceError in server actions from type export#8
damianlegawiec merged 2 commits intomainfrom
damianlegawiec/fix-address-params

Conversation

@damianlegawiec
Copy link
Member

@damianlegawiec damianlegawiec commented Feb 11, 2026

Summary

Removes the type re-export of AddressParams from addresses.ts (a "use server" module). The Next.js server actions loader miscompiles type re-exports, causing a runtime ReferenceError. Components now import AddressParams directly from @spree/sdk instead.

Fixes

  • POST /checkout now works without "ReferenceError: AddressParams is not defined"

Summary by CodeRabbit

  • Refactor
    • Improved type import organization for the addresses module by consolidating type dependencies to use the SDK as a single source of truth.

Remove the type re-export of AddressParams from addresses.ts (a "use server" module). The Next.js server actions loader miscompiles type re-exports, causing a runtime ReferenceError. Import AddressParams directly from @spree/sdk instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request reorganizes type imports by sourcing AddressParams directly from @spree/sdk instead of through a local re-export, eliminating the intermediate export from the addresses data module.

Changes

Cohort / File(s) Summary
Type Import Consolidation
src/app/[country]/[locale]/(storefront)/account/addresses/page.tsx
Added AddressParams to the @spree/sdk type-only import, removing the dependency on the local addresses module's re-export.
Re-export Removal
src/lib/data/addresses.ts
Removed the public re-export of AddressParams type, as it is no longer needed by downstream consumers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Types now flow straight from the SDK's embrace,
No detours through locals—just the perfect place!
Imports realigned with elegance and care,
Dependencies pruned for cleaner, lighter air. ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch damianlegawiec/fix-address-params

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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@damianlegawiec damianlegawiec merged commit e10f339 into main Feb 11, 2026
3 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