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

Add generics for loader data, action data, and fetchers #12180

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Oct 23, 2024

Stacked on #12177

Handles bringing over Remix generics for:

  • useLoaderData/useActionData
  • useFetcher
  • useRouteLoaderData
  • meta()
  • Await
  • serverLoader/serverAction

Am I missing anything else?

Available for testing in 0.0.0-experimental-7c6c0664d

Copy link

changeset-bot bot commented Oct 23, 2024

🦋 Changeset detected

Latest commit: 7e47853

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

This PR includes changesets to release 10 packages
Name Type
react-router Major
@react-router/architect Major
@react-router/cloudflare Major
@react-router/dev Major
react-router-dom Major
@react-router/express Major
@react-router/node Major
@react-router/serve Major
@react-router/fs-routes Major
@react-router/remix-config-routes-adapter Major

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

@@ -96,22 +96,24 @@ export interface LinksFunction {

export interface MetaMatch<
RouteId extends string = string,
Loader extends LoaderFunction | unknown = unknown
Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed during testing that I'm not sure we ever handled meta types for clientLoader. I think as long as we always union with undefined this should be valid since meta would have no data on initial render for clientLoader-only routes.

Hybrid routes are trickier because meta would have data for the server loader on SSR, and on initial hydration and then would have clientLoader data subsequently - but I think that's just a userland solution via MetaFunction<typeof loader | typeof clientLoader>

Base automatically changed from brophdawg11/clean-up-types to dev October 23, 2024 19:13
@brophdawg11 brophdawg11 merged commit 5c7cc02 into dev Oct 23, 2024
5 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/generics branch October 23, 2024 19:25
Copy link
Contributor

🤖 Hello there,

We just published version 7.0.0-pre.2 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 7.0.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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.

1 participant