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

urlQL style #1651

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion packages/hydrogen/src/storefront.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,16 @@ export function createStorefrontClient<TI18n extends I18nBase>(
errors = [{message: body}];
}

throwGraphQLError({...errorOptions, errors});
// throwGraphQLError({...errorOptions, errors});
return {error: {
response: {
status: response.status,
url,
statusText: response.statusText,
headers: Array.from(response.headers.entries()),
},
errors,
}} as T & {error: StorefrontError};
}

const {data, errors} = body as GraphQLApiResponse<T>;
Expand Down
3 changes: 3 additions & 0 deletions templates/demo-store/app/routes/($locale).network-error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useLoaderData } from '@remix-run/react';

Check failure on line 1 in templates/demo-store/app/routes/($locale).network-error.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint

Replace `·useLoaderData·` with `useLoaderData`
import {json, type LoaderFunctionArgs} from '@shopify/remix-oxygen';

export async function loader ({

Check failure on line 4 in templates/demo-store/app/routes/($locale).network-error.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint

Replace `·({⏎··context:·{storefront},⏎` with `({context:·{storefront}`
context: {storefront},
}: LoaderFunctionArgs) {
const data = await storefront.query(FEATURED_COLLECTIONS_QUERY, {
Expand All @@ -12,7 +13,9 @@
}

export default function NetworkError() {
const data = useLoaderData<typeof loader>();
console.log('data', data);

Check warning on line 17 in templates/demo-store/app/routes/($locale).network-error.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint

Unexpected console statement
return (<p>Don't expect to reach here</p>)

Check failure on line 18 in templates/demo-store/app/routes/($locale).network-error.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint

Replace `(<p>Don't·expect·to·reach·here</p>)` with `<p>Don't·expect·to·reach·here</p>;`

Check failure on line 18 in templates/demo-store/app/routes/($locale).network-error.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint

`'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`
}

export const FEATURED_COLLECTIONS_QUERY = `#graphql
Expand Down
Loading