-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
SSR API Updates #9058
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
SSR API Updates #9058
Conversation
|
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, | ||
}; |
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.
Export things for use in Remix
> | ||
<DataRouter /> | ||
</DataRouterProvider> | ||
); |
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.
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> & { |
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.
Export for use in remix
}, | ||
getFetcher() { | ||
throw msg("getFetcher"); | ||
return IDLE_FETCHER; |
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.
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` |
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.
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"); |
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.
Make the server load use location.key = "default"
9822941
to
a45f9b3
Compare
bde4466
to
7b000e2
Compare
Follow up changes to #9013 based on issues encountered while integrating this into Remix as well as API reviews