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

Fix the method prop case in Server Actions transform #64398

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,16 @@ impl<C: Comments> VisitMut for ServerActions<C> {
}
}

fn visit_mut_method_prop(&mut self, m: &mut MethodProp) {
let old_in_export_decl = self.in_export_decl;
let old_in_default_export_decl = self.in_default_export_decl;
self.in_export_decl = false;
self.in_default_export_decl = false;
m.visit_mut_children_with(self);
self.in_export_decl = old_in_export_decl;
self.in_default_export_decl = old_in_default_export_decl;
}

fn visit_mut_arrow_expr(&mut self, a: &mut ArrowExpr) {
// Arrow expressions need to be visited in prepass to determine if it's
// an action function or not.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use server'

export const action = {
async f(x) {
;(() => {
console.log(x)
})()
},
}.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* __next_internal_action_entry_do_not_use__ {"f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const action = {
async f (x) {
;
(()=>{
console.log(x);
})();
}
}.f;
import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([
action
]);
registerServerReference("f14702b5a021dd117f7ec7a3c838f397c2046d3b", action);