@@ -12,17 +12,21 @@ import {
1212 useMatches ,
1313 useRouteError ,
1414} from '@remix-run/react' ;
15- import type { SentryMetaArgs } from '@sentry/remix' ;
16- import { useNonce } from '@shopify/hydrogen' ;
17- import type { CustomerAccessToken } from '@shopify/hydrogen/storefront-api-types' ;
18- import { type LoaderArgs , defer } from '@shopify/remix-oxygen' ;
15+ import type { SentryMetaArgs } from '@sentry/remix' ;
16+ import { useNonce } from '@shopify/hydrogen' ;
17+ import type { CustomerAccessToken } from '@shopify/hydrogen/storefront-api-types' ;
18+ import { type LoaderArgs , defer } from '@shopify/remix-oxygen' ;
1919import favicon from '../public/favicon.svg' ;
20- import type { HydrogenSession } from '../server' ;
20+ import type { HydrogenSession } from '../server' ;
2121
2222import * as Sentry from '@sentry/remix' ;
2323
2424// This is important to avoid re-fetching root queries on sub-navigations
25- export const shouldRevalidate : ShouldRevalidateFunction = ( { formMethod, currentUrl, nextUrl } ) => {
25+ export const shouldRevalidate : ShouldRevalidateFunction = ( {
26+ formMethod,
27+ currentUrl,
28+ nextUrl,
29+ } ) => {
2630 // revalidate when a mutation is performed e.g add to cart, login...
2731 if ( formMethod && formMethod !== 'GET' ) {
2832 return true ;
@@ -46,17 +50,20 @@ export function links() {
4650 rel : 'preconnect' ,
4751 href : 'https://shop.app' ,
4852 } ,
49- { rel : 'icon' , type : 'image/svg+xml' , href : favicon } ,
53+ { rel : 'icon' , type : 'image/svg+xml' , href : favicon } ,
5054 ] ;
5155}
5256
53- export async function loader ( { context } : LoaderArgs ) {
54- const { storefront, session, cart } = context ;
57+ export async function loader ( { context} : LoaderArgs ) {
58+ const { storefront, session, cart} = context ;
5559 const customerAccessToken = await session . get ( 'customerAccessToken' ) ;
5660 const publicStoreDomain = context . env . PUBLIC_STORE_DOMAIN ;
5761
5862 // validate the customer access token is valid
59- const { isLoggedIn, headers } = await validateCustomerAccessToken ( session , customerAccessToken ) ;
63+ const { isLoggedIn, headers} = await validateCustomerAccessToken (
64+ session ,
65+ customerAccessToken ,
66+ ) ;
6067
6168 // defer the cart query by not awaiting it
6269 const cartPromise = cart . get ( ) ;
@@ -88,11 +95,11 @@ export async function loader({ context }: LoaderArgs) {
8895 SENTRY_DSN : process . env . E2E_TEST_DSN ,
8996 } ,
9097 } ,
91- { headers } ,
98+ { headers} ,
9299 ) ;
93100}
94101
95- export const meta = ( { data } : SentryMetaArgs < MetaFunction < typeof loader > > ) => {
102+ export const meta = ( { data} : SentryMetaArgs < MetaFunction < typeof loader > > ) => {
96103 return [
97104 {
98105 env : data . ENV ,
@@ -110,7 +117,7 @@ export const meta = ({ data }: SentryMetaArgs<MetaFunction<typeof loader>>) => {
110117
111118function App ( ) {
112119 const nonce = useNonce ( ) ;
113- const { ENV } = useLoaderData ( ) ;
120+ const { ENV } = useLoaderData ( ) ;
114121
115122 return (
116123 < html lang = "en" >
@@ -135,7 +142,8 @@ function App() {
135142 ) ;
136143}
137144
138- export default Sentry . withSentry ( App ) ;
145+ // export default Sentry.withSentry(App);
146+ export default App ;
139147
140148export function ErrorBoundary ( ) {
141149 const error = useRouteError ( ) ;
@@ -144,8 +152,8 @@ export function ErrorBoundary() {
144152 let errorMessage = 'Unknown error' ;
145153 let errorStatus = 500 ;
146154
147- // Send the error to Sentry
148- const eventId = Sentry . captureRemixErrorBoundaryError ( error ) ;
155+ // // Send the error to Sentry
156+ // const eventId = Sentry.captureRemixErrorBoundaryError(error);
149157
150158 if ( isRouteErrorResponse ( error ) ) {
151159 errorMessage = error ?. data ?. message ?? error . data ;
@@ -198,11 +206,14 @@ export function ErrorBoundary() {
198206 * );
199207 * ```
200208 * */
201- async function validateCustomerAccessToken ( session : HydrogenSession , customerAccessToken ?: CustomerAccessToken ) {
209+ async function validateCustomerAccessToken (
210+ session : HydrogenSession ,
211+ customerAccessToken ?: CustomerAccessToken ,
212+ ) {
202213 let isLoggedIn = false ;
203214 const headers = new Headers ( ) ;
204215 if ( ! customerAccessToken ?. accessToken || ! customerAccessToken ?. expiresAt ) {
205- return { isLoggedIn, headers } ;
216+ return { isLoggedIn, headers} ;
206217 }
207218
208219 const expiresAt = new Date ( customerAccessToken . expiresAt ) . getTime ( ) ;
@@ -216,7 +227,7 @@ async function validateCustomerAccessToken(session: HydrogenSession, customerAcc
216227 isLoggedIn = true ;
217228 }
218229
219- return { isLoggedIn, headers } ;
230+ return { isLoggedIn, headers} ;
220231}
221232
222233const MENU_FRAGMENT = `#graphql
0 commit comments