-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Which project does this relate to?
Start
Describe the bug
Calling a server function from inside a createClientOnlyFn triggers following error:
serverFnInfo {
functionName: 'serverFn_createServerFn_handler',
importer: [Function: importer]
}
fnModule [Object: null prototype] [Module] { component: [Getter] }
Error: Server function module export not resolved for serverFn ID: src_routes_index_tsx--serverFn_createServerFn_handler
export const Route = createFileRoute("/")({
component: Home,
});
const serverFn = createServerFn().handler(() => {
console.log("Hello");
});
const clientFn = createClientOnlyFn(() => {
serverFn();
});
function Home() {
return <button onClick={() => clientFn()}>Hello</button>;
}
Your Example Website or App
https://github.com/ulrichstark/tanstack-start-server-fn-export-not-resolved
Steps to Reproduce the Bug or Issue
- Clone https://github.com/ulrichstark/tanstack-start-server-fn-export-not-resolved
- npm run dev
- click the button
Expected behavior
I expect to see "Hello" in terminal of server because I expect that I can call server functions from functions that are only available on the client.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.132.41
- OS: macOS
- Browser: Chrome
Additional context
Removing the wrapping createClientOnlyFn of clientFn fixes the issue.