@@ -70,8 +70,8 @@ export async function setToSetSimple(set: Set, lang: SupportedLanguages): Promis
7070 const pics = await getSetPictures ( set , lang )
7171 return {
7272 cardCount : {
73- official : set . cardCount . official ,
74- total : Math . max ( set . cardCount . official , cards . length )
73+ official : set . cardCount ? .official ?? 0 , // keep at zero to not break clients
74+ total : Math . max ( set . cardCount ? .official ?? 0 , cards . length )
7575 } ,
7676 id : set . id ,
7777 logo : pics [ 0 ] ,
@@ -106,9 +106,9 @@ export async function setToSetSingle(set: Set, lang: SupportedLanguages): Promis
106106 firstEd : cards . reduce ( ( count , card ) => count + getVariantCountForType ( card [ 1 ] , "firstEdition" ) , 0 ) ,
107107 holo : cards . reduce ( ( count , card ) => count + getVariantCountForType ( card [ 1 ] , "holo" ) , 0 ) ,
108108 normal : cards . reduce ( ( count , card ) => count + getVariantCountForType ( card [ 1 ] , "normal" ) , 0 ) ,
109- official : set . cardCount . official ,
109+ official : set . cardCount ? .official ?? 0 , // keep at zero to not break clients
110110 reverse : cards . reduce ( ( count , card ) => count + getVariantCountForType ( card [ 1 ] , "reverse" ) , 0 ) ,
111- total : Math . max ( set . cardCount . official , cards . length )
111+ total : Math . max ( set . cardCount ? .official ?? 0 , cards . length )
112112 } ,
113113 cards : await Promise . all ( cards . map ( ( [ id , card ] ) => cardToCardSimple ( id , card , lang ) ) ) ,
114114 id : set . id ,
0 commit comments