Skip to content

Conversation

@yashranaway
Copy link
Contributor

@yashranaway yashranaway commented Jan 26, 2026

Issue: #3042
Fixes: #3042

Previous PR: #3081

Description

Problem

The checkout page currently uses React on Rails with ERB templates, which is inconsistent with our ongoing migration to Inertia.js. This creates maintenance overhead and prevents us from leveraging Inertia's benefits like simplified data passing and better SPA-like navigation.

Solution

Migrate the public checkout page from React on Rails to Inertia while preserving all existing functionality:

  • Move checkout logic from server-components/CheckoutPage.tsx to components/Checkout/CheckoutPageContent.tsx
  • Create new Inertia page at pages/Checkout/Index.tsx with disableLayout = true
  • Update controller to use render inertia: instead of ERB + react_component
  • Delete the old ERB view, server component, SSR registration, and checkout pack
  • Update tests to use Inertia test helpers with actual prop value assertions

Before/After

Before

Screen.Recording.2026-01-24.at.4.11.04.AM.mov

After

Logged out

Screen.Recording.2026-01-24.at.4.12.11.AM.mov

Logged in

Screen.Recording.2026-01-24.at.4.13.27.AM.mov

Test Results

image

Checklist


AI Disclosure

Claude Code (Claude Opus 4.5) was used as a coding assistant for this migration - helping with code extraction, Inertia patterns, and test updates.

@yashranaway yashranaway changed the title 3042 migrate checkout to inertia Migration of checkout page Jan 26, 2026
Copy link
Contributor Author

@yashranaway yashranaway left a comment

Choose a reason for hiding this comment

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

Self-review comments for the Checkout page Inertia migration.

@yashranaway yashranaway marked this pull request as ready for review January 26, 2026 17:25
@yashranaway
Copy link
Contributor Author

@EmCousin Addressed all the review comments from #3081, could you please take a look again?

@ershad
Copy link
Member

ershad commented Jan 28, 2026

@claude review the PR.

@claude
Copy link

claude bot commented Jan 28, 2026

Claude encountered an error —— View job

Command failed: git fetch origin --depth=20 3042-migrate-checkout-to-inertia

I'll analyze this and get back to you.

Copy link
Collaborator

@Pradumn27 Pradumn27 left a comment

Choose a reason for hiding this comment

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

Hey @yashranaway _a, added some comments, please check.

Also the issue mentions to migrate:
Internal API endpoints
I don't see any endpoints getting migrated can you list the reason(if any) or migrate the APIs too if possible

Copy link
Collaborator

Choose a reason for hiding this comment

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

inline the CheckoutPage component here directly and use the .loggedInUserLayout to get the logged in user provider wrappers, won't need this created wrapper then

@@ -1,3 +0,0 @@
<%= render("shared/recaptcha_script") %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is this loaded now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yashranaway still don't see this being loaded in the component

Comment on lines -39 to -40
html = Nokogiri::HTML.parse(response.body)
expect(html.xpath("//meta[@property='gr:logged_in_user:id']/@content").text).to eq(user.external_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this removed?

end
end

context "when the cart matching the `cart_id` query param has the `browser_guid` same as the current `_gumroad_guid` cookie value" do
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems unnecessry space, revert

@neetogit-bot neetogit-bot bot assigned yashranaway and unassigned yashranaway Jan 29, 2026
@yashranaway
Copy link
Contributor Author

Hey @Pradumn27 _a , updated as per review:

Migrated the internal cart API following the same pattern as other Inertia migrations (collaborators, etc.)

  • Api::Internal::CartsControllerCheckout::CartsController
  • /api/internal/cart → /checkout/cart
  • Updated frontend to use Routes.checkout_cart_path()

@neetogit-bot neetogit-bot bot assigned Pradumn27 and unassigned yashranaway Jan 30, 2026
@yashranaway yashranaway marked this pull request as draft January 30, 2026 03:18
@yashranaway yashranaway marked this pull request as ready for review January 30, 2026 03:22
Copy link
Collaborator

@Pradumn27 Pradumn27 left a comment

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

why change the controller location? these are still internal apis just rendered via inertia

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted, cart API stays at Api::Internal::CartsController. My bad, only the page itself needed to move to Inertia.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep reverted this too, spec is back at api/internal/.

@@ -1,3 +0,0 @@
<%= render("shared/recaptcha_script") %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

@yashranaway still don't see this being loaded in the component

@yashranaway
Copy link
Contributor Author

yashranaway commented Feb 1, 2026

@yashranaway still don't see this being loaded in the component

@Pradumn27 _a The recaptcha script is already loaded dynamically by the useRecaptcha hook in PaymentForm.tsx — it creates the script tag in the DOM itself. So the ERB partial was redundant.

@neetogit-bot neetogit-bot bot assigned Pradumn27 and unassigned yashranaway Feb 1, 2026
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.

Migrate Checkout Page to Inertia

3 participants