-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support async component for React Server component in JSX v4 (#6399)
* add tests * support async in JSX ppx * update changelog * convert async component type * eof * use asyncComponent func * fix polymorphic type inference * remove duplicated function * relocate ast_await into ml * remove duplicated is_async function
- Loading branch information
Showing
10 changed files
with
83 additions
and
8 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
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
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
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
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
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
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
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
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,19 @@ | ||
let f = a => Js.Promise.resolve(a + a) | ||
|
||
module C0 = { | ||
@react.component | ||
let make = async (~a) => { | ||
let a = await f(a) | ||
<div> {React.int(a)} </div> | ||
} | ||
} | ||
|
||
module C1 = { | ||
@react.component | ||
let make = async (~status) => { | ||
switch status { | ||
| #on => React.string("on") | ||
| #off => React.string("off") | ||
} | ||
} | ||
} |
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,31 @@ | ||
let f = a => Js.Promise.resolve(a + a) | ||
|
||
module C0 = { | ||
type props<'a> = {a: 'a} | ||
|
||
let make = async ({a, _}: props<_>) => { | ||
let a = await f(a) | ||
ReactDOM.jsx("div", {children: ?ReactDOM.someElement({React.int(a)})}) | ||
} | ||
let make = { | ||
let \"AsyncAwait$C0" = (props: props<_>) => JsxPPXReactSupport.asyncComponent(make(props)) | ||
|
||
\"AsyncAwait$C0" | ||
} | ||
} | ||
|
||
module C1 = { | ||
type props<'status> = {status: 'status} | ||
|
||
let make = async ({status, _}: props<_>) => { | ||
switch status { | ||
| #on => React.string("on") | ||
| #off => React.string("off") | ||
} | ||
} | ||
let make = { | ||
let \"AsyncAwait$C1" = (props: props<_>) => JsxPPXReactSupport.asyncComponent(make(props)) | ||
|
||
\"AsyncAwait$C1" | ||
} | ||
} |