-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Method/function props of exported objects are not server functions
This is a follow-up fix for #72969. Method or function properties of exported objects in `"use cache"` or `"use server"` files must not be compiled into server functions.
- Loading branch information
1 parent
fd5dc5f
commit 1f4c2f5
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/next-custom-transforms/tests/fixture/server-actions/server/56/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use cache' | ||
|
||
// No method nor function property should be considered a cache function. | ||
export const obj = { | ||
foo() { | ||
return 1 | ||
}, | ||
async bar() { | ||
return 2 | ||
}, | ||
baz: () => 2, | ||
qux: async () => 3, | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; | ||
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; | ||
// No method nor function property should be considered a cache function. | ||
export const obj = { | ||
foo () { | ||
return 1; | ||
}, | ||
async bar () { | ||
return 2; | ||
}, | ||
baz: ()=>2, | ||
qux: async ()=>3 | ||
}; |