File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -14,20 +14,15 @@ type WithNodeReleaseProps = {
1414// Note that Hooks cannot be used in a RSC async component
1515// Async Components do not get re-rendered at all.
1616const WithNodeRelease : FC < WithNodeReleaseProps > = async ( {
17- status,
17+ status : statuses ,
1818 children : Component ,
1919} ) => {
20- const releaseData = await provideReleaseData ( ) ;
21-
22- let matchingRelease : NodeRelease | undefined ;
23- for ( const statusItem of Array . isArray ( status ) ? status : [ status ] ) {
24- matchingRelease = releaseData . find (
25- release => release . status === statusItem
26- ) ;
27- if ( matchingRelease ) {
28- break ;
29- }
30- }
20+ const releases = await provideReleaseData ( ) ;
21+
22+ const matchingRelease = [ statuses ]
23+ . flat ( )
24+ . map ( status => releases . find ( release => release . status === status ) )
25+ . find ( Boolean ) ;
3126
3227 if ( matchingRelease ) {
3328 return < Component release = { matchingRelease } /> ;
You can’t perform that action at this time.
0 commit comments