Skip to content

Conversation

brophdawg11
Copy link
Contributor

Follow up changes to #9013 based on issues encountered while integrating this into Remix as well as API reviews

@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2022

⚠️ No Changeset found

Latest commit: a7abf9f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

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

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

ParamKeyValuePair,
SubmitOptions,
URLSearchParamsInit,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Export things for use in Remix

>
<DataRouter />
</DataRouterProvider>
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got rid of useRenderDataRouter in favor of DataRouterProvider and DataRouter which gives us a better way to compose this around RemixEntry (and it's just a nicer API than the hook)

DataRouterProvider -> renders the data contexts given an instantiated router
DataRouter -> Small wrapper around Router that leverages the data router in context

let fetcherId = 0;

type FetcherWithComponents<TData> = Fetcher<TData> & {
export type FetcherWithComponents<TData> = Fetcher<TData> & {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Export for use in remix

},
getFetcher() {
throw msg("getFetcher");
return IDLE_FETCHER;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can';t throw here for SSR of useFetcher. Fetchers are always IDLE during SSR - it will throw if you try to do anything with them though.

if (foundMissingHydrationData) {
console.warn(
`The provided hydration data did not find loaderData for all matched ` +
`routes with loaders. Performing a full initial data load`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't do this in a remix context unfortunately. Every route has a loader for JS preloading - but not every route's loader will fetch data or put an entry in loaderData. I guess we could require remix to return null as it's loaderData in that case?

hydrationData = {
    loaderData: {
        routeWithoutLoader: null
    }
}

What do you think?

} {
let url = new URL(req.url);
let location = createLocation("", createPath(url));
let location = createLocation("", createPath(url), null, "default");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make the server load use location.key = "default"

@brophdawg11 brophdawg11 force-pushed the brophdawg11/rrr branch 3 times, most recently from 9822941 to a45f9b3 Compare July 18, 2022 14:41
@brophdawg11 brophdawg11 marked this pull request as ready for review July 21, 2022 21:01
@brophdawg11 brophdawg11 merged commit 5c63fee into dev Jul 22, 2022
@brophdawg11 brophdawg11 deleted the brophdawg11/rrr branch July 22, 2022 14:47
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