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

Deferred API updates #9070

Merged
merged 15 commits into from
Jul 20, 2022
Merged

Deferred API updates #9070

merged 15 commits into from
Jul 20, 2022

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Jul 18, 2022

Aligns with new changes in remix-run/remix#3434

  • Remove Deferrable/ResolvedDeferrable in favor of raw Promise's and Awaited
  • Remove generics from useDeferredData until useLoaderData generic is decided in 6.5
  • Support array usages: return deferred([ await critical() ,lazy() ])
  • Updates Deferred errorElement to be a legit React error boundary and also handle render errors

@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2022

🦋 Changeset detected

Latest commit: 3c71f09

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
react-router Patch
@remix-run/router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

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

? T3
: T2
: T;

/**
* Returns the happy-path data from the nearest ancestor <Deferred /> value
*/
export function useDeferredData<Data>() {
Copy link
Contributor Author

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"]>

Copy link
Member

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.

Copy link
Contributor Author

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 🪓

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brophdawg11 brophdawg11 changed the title chore: remove Deferrable/ResolvedDeferrable types for raw Promises Deferred API updates Jul 18, 2022
@brophdawg11
Copy link
Contributor Author

support return deferred(Promise)

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

Successfully merging this pull request may close these issues.

3 participants