@@ -12,17 +12,21 @@ import {
12
12
useMatches ,
13
13
useRouteError ,
14
14
} 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' ;
19
19
import favicon from '../public/favicon.svg' ;
20
- import type { HydrogenSession } from '../server' ;
20
+ import type { HydrogenSession } from '../server' ;
21
21
22
22
import * as Sentry from '@sentry/remix' ;
23
23
24
24
// 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
+ } ) => {
26
30
// revalidate when a mutation is performed e.g add to cart, login...
27
31
if ( formMethod && formMethod !== 'GET' ) {
28
32
return true ;
@@ -46,17 +50,20 @@ export function links() {
46
50
rel : 'preconnect' ,
47
51
href : 'https://shop.app' ,
48
52
} ,
49
- { rel : 'icon' , type : 'image/svg+xml' , href : favicon } ,
53
+ { rel : 'icon' , type : 'image/svg+xml' , href : favicon } ,
50
54
] ;
51
55
}
52
56
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 ;
55
59
const customerAccessToken = await session . get ( 'customerAccessToken' ) ;
56
60
const publicStoreDomain = context . env . PUBLIC_STORE_DOMAIN ;
57
61
58
62
// 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
+ ) ;
60
67
61
68
// defer the cart query by not awaiting it
62
69
const cartPromise = cart . get ( ) ;
@@ -88,11 +95,11 @@ export async function loader({ context }: LoaderArgs) {
88
95
SENTRY_DSN : process . env . E2E_TEST_DSN ,
89
96
} ,
90
97
} ,
91
- { headers } ,
98
+ { headers} ,
92
99
) ;
93
100
}
94
101
95
- export const meta = ( { data } : SentryMetaArgs < MetaFunction < typeof loader > > ) => {
102
+ export const meta = ( { data} : SentryMetaArgs < MetaFunction < typeof loader > > ) => {
96
103
return [
97
104
{
98
105
env : data . ENV ,
@@ -110,7 +117,7 @@ export const meta = ({ data }: SentryMetaArgs<MetaFunction<typeof loader>>) => {
110
117
111
118
function App ( ) {
112
119
const nonce = useNonce ( ) ;
113
- const { ENV } = useLoaderData ( ) ;
120
+ const { ENV } = useLoaderData ( ) ;
114
121
115
122
return (
116
123
< html lang = "en" >
@@ -135,7 +142,8 @@ function App() {
135
142
) ;
136
143
}
137
144
138
- export default Sentry . withSentry ( App ) ;
145
+ // export default Sentry.withSentry(App);
146
+ export default App ;
139
147
140
148
export function ErrorBoundary ( ) {
141
149
const error = useRouteError ( ) ;
@@ -144,8 +152,8 @@ export function ErrorBoundary() {
144
152
let errorMessage = 'Unknown error' ;
145
153
let errorStatus = 500 ;
146
154
147
- // Send the error to Sentry
148
- const eventId = Sentry . captureRemixErrorBoundaryError ( error ) ;
155
+ // // Send the error to Sentry
156
+ // const eventId = Sentry.captureRemixErrorBoundaryError(error);
149
157
150
158
if ( isRouteErrorResponse ( error ) ) {
151
159
errorMessage = error ?. data ?. message ?? error . data ;
@@ -198,11 +206,14 @@ export function ErrorBoundary() {
198
206
* );
199
207
* ```
200
208
* */
201
- async function validateCustomerAccessToken ( session : HydrogenSession , customerAccessToken ?: CustomerAccessToken ) {
209
+ async function validateCustomerAccessToken (
210
+ session : HydrogenSession ,
211
+ customerAccessToken ?: CustomerAccessToken ,
212
+ ) {
202
213
let isLoggedIn = false ;
203
214
const headers = new Headers ( ) ;
204
215
if ( ! customerAccessToken ?. accessToken || ! customerAccessToken ?. expiresAt ) {
205
- return { isLoggedIn, headers } ;
216
+ return { isLoggedIn, headers} ;
206
217
}
207
218
208
219
const expiresAt = new Date ( customerAccessToken . expiresAt ) . getTime ( ) ;
@@ -216,7 +227,7 @@ async function validateCustomerAccessToken(session: HydrogenSession, customerAcc
216
227
isLoggedIn = true ;
217
228
}
218
229
219
- return { isLoggedIn, headers } ;
230
+ return { isLoggedIn, headers} ;
220
231
}
221
232
222
233
const MENU_FRAGMENT = `#graphql
0 commit comments