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

Support Remix Single Fetch in @shopify/oxygen-remix #2623

Closed
chinanderm opened this issue Oct 28, 2024 · 6 comments
Closed

Support Remix Single Fetch in @shopify/oxygen-remix #2623

chinanderm opened this issue Oct 28, 2024 · 6 comments

Comments

@chinanderm
Copy link

chinanderm commented Oct 28, 2024

What is the location of your example repository?

No response

Which package or tool is having this issue?

Oxygen

What version of that package or tool are you using?

@shopify/[email protected]

What version of Remix are you using?

2.13.1

Steps to Reproduce

Follow the Single Fetch migration docs from Remix and...

Turn on v3_singleFetch in Remix config:

{
  // ...
  v3_singleFetch: true
  // ...
}

Enable the TS behavior for Single Fetch:

declare module "@shopify/remix-oxygen" {
  interface Future {
    v3_singleFetch: true;
  }
}

Update json() usage with data():

import { data, type LoaderFunctionArgs } from '@shopify/remix-oxygen'

export async function loader({}: LoaderFunctionArgs) {
  const headers = new Headers()

  // ...

  return data({ ... }, { headers })
}

// ...

Expected Behavior

  • @shopify/remix-oxygen exports interface Future from @remix-run/server-runtime so it can be appended to using declare module
  • @shopify/remix-oxygen exports data() function from @remix-run/server-runtime so it can be used in place of json()

Actual Behavior

  • @shopify/remix-oxygen does not export interface Future from @remix-run/server-runtime, thus it cannot be appended to using declare module
  • @shopify/remix-oxygen does not export data() function from @remix-run/server-runtime, thus it cannot be used in place of json()
@chinanderm
Copy link
Author

I forked this repo and made what I believe to be the only needed change to support Single Fetch. See: chinanderm@4cf7a87

@wizardlyhel
Copy link
Contributor

You should be able to just import those 2 missing exports from @remix-run/server-runtime. @shopify/remix-oxygen only had to implement createRequestHandler.

We still need some time to turn on single fetch

@chinanderm
Copy link
Author

Thanks @wizardlyhel!

We still need some time to turn on single fetch

Just to confirm — we shouldn't be deploying Single Fetch code to production yet with Hydrogen/Oxygen?

@wizardlyhel
Copy link
Contributor

That's correct - There a couple things we had to do in order to support single fetch.

@michael-land
Copy link

'defer' is now marked as deprecated in 2.14.0

@kwtech-dev
Copy link

Can we keep this issue open? It seems that "Support Remix Single Fetch" is not completed yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants