Skip to content

Commit

Permalink
RSC: No basePath arg to serve() (#10030)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Feb 19, 2024
1 parent 12d3fc1 commit 70602de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vite/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const checkStatus = async (
return response
}

export function serve<Props>(rscId: string, basePath = '/rw-rsc/') {
const BASE_PATH = '/rw-rsc/'

export function serve<Props>(rscId: string) {
type SetRerender = (
rerender: (next: [ReactElement, string]) => void
) => () => void
Expand Down Expand Up @@ -51,7 +53,7 @@ export function serve<Props>(rscId: string, basePath = '/rw-rsc/') {
id = '_'
}

const response = fetch(basePath + id + '/' + searchParams, {
const response = fetch(BASE_PATH + id + '/' + searchParams, {
method: 'POST',
body: await encodeReply(args),
headers: {
Expand All @@ -75,12 +77,12 @@ export function serve<Props>(rscId: string, basePath = '/rw-rsc/') {

console.log(
'fetchRSC before createFromFetch',
basePath + rscId + '/' + searchParams
BASE_PATH + rscId + '/' + searchParams
)

const response =
prefetched ||
fetch(basePath + rscId + '/' + searchParams, {
fetch(BASE_PATH + rscId + '/' + searchParams, {
headers: {
'rw-rsc': '1',
},
Expand Down

0 comments on commit 70602de

Please sign in to comment.