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

Single Fetch Example #2159

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
4 changes: 3 additions & 1 deletion packages/hydrogen/src/customer/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function defaultAuthStatusHandler(request: CrossRuntimeRequest) {

const redirectTo =
DEFAULT_LOGIN_URL +
`?${new URLSearchParams({return_to: pathname}).toString()}`;
`?${new URLSearchParams({
return_to: pathname.replace(/\.data$/, ''), // for single fetch
}).toString()}`;

return redirect(redirectTo);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/mini-oxygen/src/common/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const OXYGEN_COMPAT_PARAMS = {
compatibilityFlags: ['streams_enable_constructors' as const],
compatibilityFlags: [
'streams_enable_constructors' as const,
'http_headers_getsetcookie' as any,
],
compatibilityDate: '2022-10-31' as const,
};
4 changes: 2 additions & 2 deletions templates/skeleton/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export default async function handleRequest(
shop: {
checkoutDomain: context.env.PUBLIC_CHECKOUT_DOMAIN,
storeDomain: context.env.PUBLIC_STORE_DOMAIN,
}
},
});

const body = await renderToReadableStream(
<NonceProvider>
<RemixServer context={remixContext} url={request.url} />
<RemixServer context={remixContext} url={request.url} nonce={nonce} />
</NonceProvider>,
{
nonce,
Expand Down
5 changes: 4 additions & 1 deletion templates/skeleton/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"baseUrl": ".",
"types": ["@shopify/oxygen-workers-types"],
"types": [
"@shopify/oxygen-workers-types",
"@remix-run/react/future/single-fetch.d.ts"
],
"paths": {
"~/*": ["app/*"]
},
Expand Down
1 change: 1 addition & 0 deletions templates/skeleton/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineConfig({
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
unstable_singleFetch: true,
},
}),
tsconfigPaths(),
Expand Down
Loading