-
Notifications
You must be signed in to change notification settings - Fork 284
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
useLoaderData not working with defer on Remix v2 #1476
Comments
Also confirming exact same issue. You can repro the issue with the following:
import { useLoaderData } from '@remix-run/react';
import { defer } from '@shopify/remix-oxygen';
export const loader = async () => {
return defer({ test: "test" });
};
export default function Index() {
const data = useLoaderData<typeof loader>();
return (
<div>{data.test}</div>
)
}
|
I'm looking into this, and I think it's because |
5 tasks
This is now fixed with @shopify/remix-oxygen v2.0.1. |
I apologize, but the fix also requires updating to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the location of your example repository?
No response
Which package or tool is having this issue?
Hydrogen
What version of that package or tool are you using?
2023.10.0
What version of Remix are you using?
2.1.0
Steps to Reproduce
When upgrading my current project to the newest version of Hydrogen/Remix, I'm facing some Typescript issues with the
useLoaderData
behavior.Let me show you some sample code where I'm getting the issue:
This code works fine, it's just TypeScript that is having issues as you can see in the screenshot below:
I found out changing the
defer
tojson
solves the error but this is not what I want.Expected Behavior
Code compiles without Typescript errors
Actual Behavior
The TypeScript linter returns an error as shown in the screenshot above
The text was updated successfully, but these errors were encountered: