-
Notifications
You must be signed in to change notification settings - Fork 286
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
Turn on Remix v3_singleFetch
future flag
#2708
base: main
Are you sure you want to change the base?
Conversation
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
We detected some changes in |
/** | ||
* Remix (single-fetch) request objects have different url | ||
* paths when soft navigating. Examples: | ||
* | ||
* /_root.data - home page | ||
* /collections.data - collections page | ||
* | ||
* These url annotations needs to be cleaned up before constructing urls to be passed as | ||
* GET parameters for customer login url | ||
*/ | ||
const cleanedPathname = pathname | ||
.replace(/\.data$/, '') | ||
.replace(/^\/_root$/, '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new behaviour covered in any of our tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh good catch - I'll get a test in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests added
Co-authored-by: Rheese <110670476+rbshop@users.noreply.github.com>
WHY are these changes introduced?
Turn on Remix
v3_singleFetch
future flagUpgrade steps
Remix single fetch migration quick guide: https://remix.run/docs/en/main/start/future-flags#v3_singlefetch
Remix single fetch migration guide: https://remix.run/docs/en/main/guides/single-fetch
In your
vite.config.ts
, add the single fetch future flag.In your
entry.server.tsx
, addnonce
to the<RemixServer>
.const body = await renderToReadableStream( <NonceProvider> <RemixServer context={remixContext} url={request.url} + nonce={nonce} /> </NonceProvider>,
Deprecate
json
anddefer
import usage from@shopify/remix-oxygen
Remove
json()
/defer()
in favor of raw objects.Single Fetch supports JSON objects and Promises out of the box, so you can return the raw data from your loader/action functions:
If you were using the second parameter of json/defer to set a custom status or headers on your response, you can continue doing so via the new data API:
WHAT is this pull request doing?
For all templates, remove
json()
, anddefer()
Remix response functions and usedata()
Remix response function when requiredHOW to test your changes?
Make sure all templates are working properly without errors across all functions. Make sure:
Post-merge steps
Checklist