Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 2024.10.1 #85

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/components/AddToCartButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {CartLineInput} from '@shopify/hydrogen/storefront-api-types';
import {CartForm} from '@shopify/hydrogen';
import {CartForm, type OptimisticCartLineInput} from '@shopify/hydrogen';
import type {FetcherWithComponents} from '@remix-run/react';

import {Button} from '~/components/Button';
Expand All @@ -14,7 +13,7 @@ export function AddToCartButton({
...props
}: {
children: React.ReactNode;
lines: CartLineInput[];
lines: Array<OptimisticCartLineInput>;
className?: string;
variant?: 'primary' | 'secondary' | 'inline';
width?: 'auto' | 'full';
Expand Down
16 changes: 7 additions & 9 deletions app/lib/seo.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,12 @@ type ProductRequiredFields = Pick<
Product,
'title' | 'description' | 'vendor' | 'seo'
> & {
variants: {
nodes: Array<
Pick<
ProductVariant,
'sku' | 'price' | 'selectedOptions' | 'availableForSale'
>
>;
};
variants: Array<
Pick<
ProductVariant,
'sku' | 'price' | 'selectedOptions' | 'availableForSale'
>
>;
};

function productJsonLd({
Expand All @@ -107,7 +105,7 @@ function productJsonLd({
url: Request['url'];
}): SeoConfig['jsonLd'] {
const origin = new URL(url).origin;
const variants = product.variants.nodes;
const variants = product.variants;
const description = truncate(
product?.seo?.description ?? product?.description,
);
Expand Down
18 changes: 6 additions & 12 deletions app/routes/($locale).cart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Await, useRouteLoaderData} from '@remix-run/react';
import {useLoaderData} from '@remix-run/react';
import invariant from 'tiny-invariant';
import {
type LoaderFunctionArgs,
Expand All @@ -9,7 +9,6 @@ import {CartForm, type CartQueryDataReturn, Analytics} from '@shopify/hydrogen';

import {isLocalPath} from '~/lib/utils';
import {Cart} from '~/components/Cart';
import type {RootLoader} from '~/root';

export async function action({request, context}: ActionFunctionArgs) {
const {cart} = context;
Expand Down Expand Up @@ -84,18 +83,13 @@ export async function loader({context}: LoaderFunctionArgs) {
}

export default function CartRoute() {
const rootData = useRouteLoaderData<RootLoader>('root');
if (!rootData) return null;
const cart = useLoaderData<typeof loader>();

// @todo: finish on a separate PR
return (
<>
<div className="grid w-full gap-8 p-6 py-8 md:p-8 lg:p-12 justify-items-start">
<Await resolve={rootData?.cart}>
{(cart) => <Cart layout="page" cart={cart} />}
</Await>
</div>
<div className="cart">
<h1>Cart</h1>
<Cart layout="page" cart={cart} />
<Analytics.CartView />
</>
</div>
);
}
Loading
Loading