Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Last active June 10, 2025 15:35
Show Gist options
  • Save ORESoftware/076b0e365bb0f1ee4da5c0d70da4bb10 to your computer and use it in GitHub Desktop.
Save ORESoftware/076b0e365bb0f1ee4da5c0d70da4bb10 to your computer and use it in GitHub Desktop.
sever-actions.ts

with a backend server action:

'use server';

export async function createEntity(v: string, n: number, o: boolean){
 ///
  return {success: true, val: x};
}
  1. we cannot modify response headers (add metadata)
  2. cannot log response status code or automatically log response body as json

likewise on the client:

'use client';

useEffect(async () => {

   const result = await createEntity('foo', 69, true);
},[]);
  1. we cannot add metadata to the request - we cannot modify request headers using fetch
  2. aka, I want to pass a unique uuid as a header to represent the reuqest id, etc

looking for a way to hook into server actions for both client and server for these reasons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment