@@ -269,45 +269,52 @@ export const Block: React.FC<Block> = props => {
269
269
) ;
270
270
case "collection_view" :
271
271
if ( ! block ) return null ;
272
+
272
273
const collectionView = block ?. collection ?. types [ 0 ] ;
273
274
274
275
return (
275
276
< div >
276
277
< h3 className = "notion-h3" >
277
278
{ renderChildText ( block . collection ?. title ! ) }
278
279
</ h3 >
280
+
279
281
{ collectionView ?. type === "table" && (
280
282
< div style = { { maxWidth : "100%" , marginTop : 5 } } >
281
283
< table className = "notion-table" >
282
284
< thead >
283
285
< tr className = "notion-tr" >
284
286
{ collectionView . format ?. table_properties
285
287
?. filter ( p => p . visible )
286
- . map ( gp => (
288
+ . map ( ( gp , index ) => (
287
289
< th
288
290
className = "notion-th"
291
+ key = { index }
289
292
style = { { minWidth : gp . width } }
290
293
>
291
- { block . collection ?. schema [ gp . property ] . name }
294
+ { block . collection ?. schema [ gp . property ] ? .name }
292
295
</ th >
293
296
) ) }
294
297
</ tr >
295
298
</ thead >
299
+
296
300
< tbody >
297
- { block ?. collection ?. data . map ( row => (
298
- < tr className = "notion-tr" >
301
+ { block ?. collection ?. data . map ( ( row , index ) => (
302
+ < tr className = "notion-tr" key = { index } >
299
303
{ collectionView . format ?. table_properties
300
304
?. filter ( p => p . visible )
301
- . map ( gp => (
305
+ . map ( ( gp , index ) => (
302
306
< td
307
+ key = { index }
303
308
className = {
304
309
"notion-td " +
305
310
( gp . property === "title" ? "notion-bold" : "" )
306
311
}
307
312
>
308
313
{
309
314
renderChildText (
310
- row [ block . collection ?. schema [ gp . property ] . name ! ]
315
+ row [
316
+ block . collection ?. schema [ gp . property ] ?. name !
317
+ ]
311
318
) !
312
319
}
313
320
</ td >
@@ -318,6 +325,7 @@ export const Block: React.FC<Block> = props => {
318
325
</ table >
319
326
</ div >
320
327
) }
328
+
321
329
{ collectionView ?. type === "gallery" && (
322
330
< div className = "notion-gallery" >
323
331
{ block . collection ?. data . map ( ( row , i ) => (
0 commit comments