Server function not being called (?)

I'm sorry for asking help for something that should be so simple but I'm very confused. I currently have a simple async server debug function:
export const Login = async (authType: AuthType) => {
"use server";
console.log("Login", authType);
};
export const Login = async (authType: AuthType) => {
"use server";
console.log("Login", authType);
};
and it's called here:
const handleGithubSignIn = async () => {
return await Login(AuthType.Github);
};
const handleGithubSignIn = async () => {
return await Login(AuthType.Github);
};
Referenced in the button's onclick here:
<button
class="btn"
onClick={() => {
console.log("debug");
handleGithubSignIn();
}}
>
Debug Test
</button>
<button
class="btn"
onClick={() => {
console.log("debug");
handleGithubSignIn();
}}
>
Debug Test
</button>
The console log for the server isn't called, and neither is the client button even There are no network requests being sent either The build does not throw any errors, only some warnings which I believe do not pertain to this The only debug info I have is in the picture attached What could be going wrong?
No description
4 Replies
ⱼ ₒ ₑ
ⱼ ₒ ₑOP7d ago
I'm also on the latest version of all solid pkgs, start is v1.1.1 if it matters It seems like it just breaks all interactivity on the file that is trying to use it, none of the client interactivity works
Madaxen86
Madaxen867d ago
I think you should make handleGithunSignIn an action and then use useAction to https://docs.solidjs.com/solid-router/reference/data-apis/action#action Maybe you don’t need useAction https://docs.solidjs.com/solid-router/reference/data-apis/use-action
peerreynders
peerreynders7d ago
- This may simply be a 1.1.x issue; the fastest way to figure that out is to go back to 1.0.11. - Alternately your module organization may need improving. Whatever module contains
export const Login = async (authType: AuthType) => {
"use server";
console.log("Login", authType);
};
export const Login = async (authType: AuthType) => {
"use server";
console.log("Login", authType);
};
Needs to be classified as a client side module: - Inside that module any server side code should be strictly under "use server" - Any server logic under "use server" should only use functions imported from server side modules. It should not reference code within the same module (which is a client side module) because that may cause that "other server code" to be pulled into the client side bundle.
ⱼ ₒ ₑ
ⱼ ₒ ₑOP7d ago
Hey guys thank you for the tips It helped but the main issue was actually trying to use the typescript enum and pass it in

Did you find this page helpful?