-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Deferred API updates #9070
Deferred API updates #9070
Conversation
🦋 Changeset detectedLatest commit: 3c71f09 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/react-router/lib/hooks.tsx
Outdated
? T3 | ||
: T2 | ||
: T; | ||
|
||
/** | ||
* Returns the happy-path data from the nearest ancestor <Deferred /> value | ||
*/ | ||
export function useDeferredData<Data>() { |
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.
@jacob-ebey @pcattori We decided to leave generics off useLoaderData
/useActionData
for 6.4.0
so we can see how they differ in reality when you remove the network boundary, and we figure we will introduce the proper generics for them in a 6.5.0+
release. Should we do the same for useDeferredData
? Or do we think this type is safe and won't necessarily need to "break" based on what we land on for useLoaderData
.
Mainly want to make sure that the types that work in remix will work here too:
useDeferredData<UseDataFunctionReturn<typeof loader>["deferredProp"]>
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.
I'm honestly not sure here. I'm tempted to say rip it off until we have RR fully integrated in a SSR setup so we don't have any potential breaking changes.
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.
yeah I'm leaning that way too 🪓
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.
To be added back in once we figur eout typing for useLoaderData in 6.5
support |
Aligns with new changes in remix-run/remix#3434
Deferrable
/ResolvedDeferrable
in favor of rawPromise
's andAwaited
useDeferredData
untiluseLoaderData
generic is decided in 6.5return deferred([ await critical() ,lazy() ])
Deferred
errorElement
to be a legit React error boundary and also handle render errors