Skip to content

[Example]: RSC/SSR Cart with session#1833

Open
juanpprieto wants to merge 6 commits into
v1.x-2022-07from
@juanpprieto/server-driven-cart-with-session
Open

[Example]: RSC/SSR Cart with session#1833
juanpprieto wants to merge 6 commits into
v1.x-2022-07from
@juanpprieto/server-driven-cart-with-session

Conversation

@juanpprieto

Copy link
Copy Markdown
Contributor

Description

A hydrogen example demonstrating a 💯 .server-driven basic Cart workflow.

  • Provides a set of cart utilities (getCart, createCart...) as well as a GraphQL cart client
  • Provides a /api/cart/[action] that handle POST requests from the different get, create, add and remove form actions.
  • Persists cartId and cartCount to the session (cookie), so they can be used used during the .server lifecycle
  • Uses form actions for all interactions with the API. e.g — AddToCart, remove..
  • Provides suspendedFn a utility to enable <Suspend /> friendly async API calls from .server components

Additional context

Oxygen Demo


Before submitting the PR, please make sure you do the following:

  • Read the Contributing Guidelines
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123)
  • Update docs in this repository according to your change
  • Run yarn changeset add if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning

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