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

chore(rsc): Rename renderRoutesFromDist to renderRoutesSsr #11647

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/router/src/rsc/SsrRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LocationProvider, useLocation } from '../location.js'
import { namedRoutes } from '../namedRoutes.js'
import type { RouterProps } from '../router.js'

import { renderRoutesFromDist } from './clientSsr.js'
import { renderRoutesSsr } from './clientSsr.js'

export const Router = ({ paramTypes, children }: RouterProps) => {
return (
Expand All @@ -31,6 +31,5 @@ const LocationAwareRouter = ({ paramTypes, children }: RouterProps) => {
// Note that the value changes at runtime
Object.assign(namedRoutes, namedRoutesMap)

// @TODO(RSC): TS doesn't like that we're returning a promise, but in RSC it's ok!
return renderRoutesFromDist(pathname) as unknown as React.ReactNode
return renderRoutesSsr(pathname)
}
4 changes: 2 additions & 2 deletions packages/router/src/rsc/clientSsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ function resolveClientEntryForProd(

const rscCache = new Map<string, Thenable<React.ReactElement>>()

export async function renderRoutesFromDist<TProps extends Record<string, any>>(
export async function renderRoutesSsr<TProps extends Record<string, any>>(
pathname: string,
) {
console.log('renderRoutesFromDist pathname', pathname)
console.log('renderRoutesSsr pathname', pathname)

const cached = rscCache.get(pathname)
if (cached) {
Expand Down
Loading