File tree Expand file tree Collapse file tree
app/(docs)/concepts/auth-security Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ this section we'll go over how to protect different parts of the UploadThing
1414flow.
1515
1616<Warning >
17- Do not protect the entire /api/uploadthing route from being called by
17+ Do not protect the entire ` /api/uploadthing ` route from being called by
1818 unauthenticated users. The endpoint is called as a webhook by our server and
1919 thus must be publicly available.
2020</Warning >
Original file line number Diff line number Diff line change @@ -121,7 +121,15 @@ function CodePanel({
121121 label ?: string ;
122122 code ?: string ;
123123} ) {
124- let child = React . Children . only ( children ) ;
124+ let child : React . ReactElement | null = null ;
125+ const childrenCount = React . Children . count ( children ) ;
126+
127+ if ( childrenCount === 1 ) {
128+ child = React . Children . only ( children ) as React . ReactElement ;
129+ } else if ( childrenCount > 1 ) {
130+ // If multiple children, take the first one for prop extraction
131+ child = React . Children . toArray ( children ) [ 0 ] as React . ReactElement ;
132+ }
125133
126134 if ( React . isValidElement ( child ) ) {
127135 tag = ( child . props as { tag ?: string } ) . tag ?? tag ;
You can’t perform that action at this time.
0 commit comments