You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8f971d7
Browse filesBrowse the repository at this point in the historyBrowse files
JSX v4: keep an async component's @directive on its own function
The JSX PPX moved every attribute of a component's function onto the
generated props => make(props) wrapper. For an async component that wrapper
is a sync function returning make's promise, so
@react.component
let make = @directive("'use cache'") async (~id) => ...
compiled to function Name(props) { 'use cache'; return make(props); },
which Next.js rejects ("'use cache' functions must be async"). A directive
on an async component now stays on make, which the wrapper then reduces to.
Sync components are unchanged: their wrapper inlines make, so the directive
already lands on the one function.
Co-authored-by: Jaap Frolich <jfrolich@gmail.com>
Session: https://os.tella.dev/session/os-01a1c0bb-9d82-7375-9b3e-9714de65ddf9
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,8 @@
17
17
18
18
#### :bug: Bug fix
19
19
20
+
- JSX v4: keep `@directive` on an async component's own function instead of its generated sync wrapper, so `@react.component let make = @directive("'use cache'") async (...) => ...` compiles to an async function starting with `'use cache'`, which Next.js accepts.
0 commit comments