-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update server network debug tool (#1511)
- Loading branch information
1 parent
92840e5
commit 335371c
Showing
25 changed files
with
2,042 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
'@shopify/remix-oxygen': patch | ||
'@shopify/hydrogen': patch | ||
'@shopify/cli-hydrogen': patch | ||
'@shopify/create-hydrogen': patch | ||
--- | ||
|
||
Subrequest Profiler (stable) - Provides an overview of network requests happening on the server side | ||
|
||
#### How to use: | ||
|
||
1. Run `h2 dev` | ||
2. Visit http://localhost:3000/subrequest-profiler | ||
|
||
#### Set request display name with `storefront.query`: | ||
|
||
```tsx | ||
context.storefront.query( | ||
HOMEPAGE_FEATURED_PRODUCTS_QUERY, | ||
{ | ||
displayName: 'Feature products', | ||
variables: { | ||
country, | ||
language, | ||
}, | ||
}, | ||
) | ||
``` | ||
|
||
#### Set request debug information with `createWithCache`: | ||
|
||
```tsx | ||
const withCache = createWithCache({ | ||
cache, | ||
waitUntil, | ||
request, | ||
}); | ||
|
||
const data3p = async () => { | ||
return await withCache( | ||
['Some unique cache keys'], | ||
CacheLong(), | ||
({addDebugData}) => { | ||
return fetch('https://some-3p-endpoint.com').then(async (response) => { | ||
if (process.env.NODE_ENV === 'development') { | ||
addDebugData({ | ||
displayName: '3p endpoint display name', | ||
response, | ||
}); | ||
} | ||
|
||
return await response.json(); | ||
}); | ||
}, | ||
); | ||
}; | ||
``` | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.