Merge branch 'main' into demo-refresh

This commit is contained in:
Michael Novotny 2023-04-21 13:12:41 -05:00 committed by GitHub
commit ee3db897d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 9 deletions

View File

@ -10,7 +10,7 @@ export const metadata = {
openGraph: {
images: [
{
url: `/api/og?title=${encodeURIComponent(process.env.SITE_NAME)}`,
url: `/api/og?title=${encodeURIComponent(process.env.SITE_NAME || '')}`,
width: 1200,
height: 630
}

View File

@ -99,7 +99,7 @@ export default async function ProductPage({ params }: { params: { handle: string
async function RelatedProducts({ id }: { id: string }) {
const relatedProducts = await getProductRecommendations(id);
if (!relatedProducts) return null;
if (!relatedProducts.length) return null;
return (
<div className="px-4 py-8">

View File

@ -37,7 +37,7 @@ function ThreeItemGridItem({
export async function ThreeItemGrid() {
// Collections that start with `hidden-*` are hidden from the search page.
const homepageItems = await getCollectionProducts('hidden-homepage-featured-items', 3);
const homepageItems = await getCollectionProducts('hidden-homepage-featured-items');
if (!homepageItems[0] || !homepageItems[1] || !homepageItems[2]) return null;

View File

@ -256,12 +256,11 @@ export async function getCollection(handle: string): Promise<Collection | undefi
return reshapeCollection(res.body.data.collection);
}
export async function getCollectionProducts(handle: string, limit?: number): Promise<Product[]> {
export async function getCollectionProducts(handle: string): Promise<Product[]> {
const res = await shopifyFetch<ShopifyCollectionProductsOperation>({
query: getCollectionProductsQuery,
variables: {
handle,
first: limit
handle
}
});

View File

@ -36,9 +36,9 @@ export const getCollectionsQuery = /* GraphQL */ `
`;
export const getCollectionProductsQuery = /* GraphQL */ `
query getCollectionProducts($handle: String!, $first: Int = 100) {
query getCollectionProducts($handle: String!) {
collection(handle: $handle) {
products(first: $first) {
products(first: 100) {
edges {
node {
...product

View File

@ -199,7 +199,6 @@ export type ShopifyCollectionProductsOperation = {
};
variables: {
handle: string;
first?: number;
};
};