-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(start-server-functions-server): add base path to the RPC URL #4619
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
Conversation
thanks for this! |
Thanks! I've added the e2e test. Without this PR's changes, the test would fail with:
The test now passes with the PR's fix, confirming that server function URLs correctly include the app's basepath. |
View your CI Pipeline Execution ↗ for commit 61a7e61
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-with-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
Hi! This PR fixes a bug where server function urls are incorrect when the app uses a basePath.
The Problem:
The
createServerRpc
function (on the server) was creating URLs without the base path. However, thecreateClientRpc
function (on the client) was including it.
router/packages/start-server-functions-server/src/index.ts
Line 18 in b9f88c5
router/packages/start-server-functions-client/src/index.ts
Lines 9 to 12 in b9f88c5
For example, with a base path of '/app':
<form action={loginFn.url} method="POST">
hydration error:
This difference caused two main problems:
The Solution:
I've updated
createServerRpc
to also use the base path when it creates the URL, just like the client version does.File changed: packages/start-server-functions-server/src/index.ts
Now, both the client and server create the same correct URL.