@@ -290,45 +290,52 @@ export const Block: React.FC<Block> = props => {
290
290
) ;
291
291
case "collection_view" :
292
292
if ( ! block ) return null ;
293
+
293
294
const collectionView = block ?. collection ?. types [ 0 ] ;
294
295
295
296
return (
296
297
< div >
297
298
< h3 className = "notion-h3" >
298
299
{ renderChildText ( block . collection ?. title ! ) }
299
300
</ h3 >
301
+
300
302
{ collectionView ?. type === "table" && (
301
303
< div style = { { maxWidth : "100%" , marginTop : 5 } } >
302
304
< table className = "notion-table" >
303
305
< thead >
304
306
< tr className = "notion-tr" >
305
307
{ collectionView . format ?. table_properties
306
308
?. filter ( p => p . visible )
307
- . map ( gp => (
309
+ . map ( ( gp , index ) => (
308
310
< th
309
311
className = "notion-th"
312
+ key = { index }
310
313
style = { { minWidth : gp . width } }
311
314
>
312
- { block . collection ?. schema [ gp . property ] . name }
315
+ { block . collection ?. schema [ gp . property ] ? .name }
313
316
</ th >
314
317
) ) }
315
318
</ tr >
316
319
</ thead >
320
+
317
321
< tbody >
318
- { block ?. collection ?. data . map ( row => (
319
- < tr className = "notion-tr" >
322
+ { block ?. collection ?. data . map ( ( row , index ) => (
323
+ < tr className = "notion-tr" key = { index } >
320
324
{ collectionView . format ?. table_properties
321
325
?. filter ( p => p . visible )
322
- . map ( gp => (
326
+ . map ( ( gp , index ) => (
323
327
< td
328
+ key = { index }
324
329
className = {
325
330
"notion-td " +
326
331
( gp . property === "title" ? "notion-bold" : "" )
327
332
}
328
333
>
329
334
{
330
335
renderChildText (
331
- row [ block . collection ?. schema [ gp . property ] . name ! ]
336
+ row [
337
+ block . collection ?. schema [ gp . property ] ?. name !
338
+ ]
332
339
) !
333
340
}
334
341
</ td >
@@ -339,6 +346,7 @@ export const Block: React.FC<Block> = props => {
339
346
</ table >
340
347
</ div >
341
348
) }
349
+
342
350
{ collectionView ?. type === "gallery" && (
343
351
< div className = "notion-gallery" >
344
352
{ block . collection ?. data . map ( ( row , i ) => (
0 commit comments