Skip to content
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

improve server action transform #389

Open
hi-ogawa opened this issue Jun 11, 2024 · 1 comment
Open

improve server action transform #389

hi-ogawa opened this issue Jun 11, 2024 · 1 comment

Comments

@hi-ogawa
Copy link
Owner

hi-ogawa commented Jun 11, 2024

probably what's missing is

  • closure bind value encryption
  • smarter bind (e.g. bind only leaf property x.y instead of full x)
  • handle when "use server" appears both at the top and inside closure
@hi-ogawa
Copy link
Owner Author

hi-ogawa commented Jul 8, 2024

EDIT: fixed by #526

Also, "higher order" action seems not working, so we need to investigate.

export function validator(action: any) {
return async function (arg: string) {
"use server";
const auth = cookies().get("auth");
if (auth?.value !== "1") {
throw new Error("Unauthorized request");
}
return action(arg);
};

// TODO: probably nested server action closure not working
getAuthedUppercase={validator(async (str: string) => {
"use server";
return prefix + " " + str.toUpperCase();
})}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant