dohn
dohn
Explore posts from servers
SSolidJS
Created by dohn on 10/15/2024 in #support
What's the correct way to wrap server functions?
thanks for your help! a practical example in this case is basically how to craft a function like createAuthenticatedAction that wraps action from solid-router so that i dont have to always do auth checks inside each action (which i've been doing for like 50 actions already) i figured out a way which is defining the actual implementation of the action in a separate file with a top-level "use server" and using the single export inside action, so that works. only annoying thing is that i need to split two files just to create an action
8 replies
SSolidJS
Created by dohn on 10/15/2024 in #support
What's the correct way to wrap server functions?
from my understanding "use server" should only make a function an RPC, and it should only do it if you're not on the server already (otherwise it's just invoked) so my reasoning is I need a "use server" both inside my helper and inside the callback I pass to it, but that makes the compiler completely hang when I actually trying using it inside a form, the page will not load at all but no errors are logged to the console
8 replies
SSolidJS
Created by dohn on 5/25/2024 in #support
Do something when a submission ends if there's more than 1 action
@peerreynders thanks!
13 replies
SSolidJS
Created by dohn on 5/25/2024 in #support
Do something when a submission ends if there's more than 1 action
No description
13 replies
SSolidJS
Created by dohn on 5/25/2024 in #support
Do something when a submission ends if there's more than 1 action
@Maciek50322 Thanks for your response! Note I'm talking about useSubmission exported by solid router, not a custom hook. Your example is pretty much the case, except with two useSubmission using a form and a formAction on a button to trigger different server actions.
function Component() {
const action1 = useSubmission(myServerAction1);
const action2 = useSubmission(myServerAction2);

createEffect(() => {
console.log(action1.result);
})

createEffect(() => {
console.log(action2.result);
})

return (
<form action={action1}>
<button type="submit">
Action1
</button>
<button type="submit" formAction={action2}>
Action2
</button>
</form>
);
}
function Component() {
const action1 = useSubmission(myServerAction1);
const action2 = useSubmission(myServerAction2);

createEffect(() => {
console.log(action1.result);
})

createEffect(() => {
console.log(action2.result);
})

return (
<form action={action1}>
<button type="submit">
Action1
</button>
<button type="submit" formAction={action2}>
Action2
</button>
</form>
);
}
13 replies
NNuxt
Created by dohn on 4/25/2024 in #❓・help
How to come up with reproductions for production-only Nuxt crashes?
thank you so much! we'll give this a shot
3 replies
NNuxt
Created by dohn on 4/6/2024 in #❓・help
How to debug Node memory allocation errors?
this looks like the related issue: https://github.com/nuxt/nuxt/issues/25115 closing this since issues are being opened about it
4 replies
NNuxt
Created by dohn on 4/6/2024 in #❓・help
How to debug Node memory allocation errors?
oh ok, that's good to know. i guess it's the 3.11 update then?
4 replies