diff --git a/src/lib/components/TextelrView.svelte b/src/lib/components/TextelrView.svelte index ce6b873..02de72d 100644 --- a/src/lib/components/TextelrView.svelte +++ b/src/lib/components/TextelrView.svelte @@ -13,13 +13,13 @@ {#if showArticles} - {#each [...iterArrayOrSingleton(textelr.STRUCT.LIEN_ART)] as lienArt} + {#each [...iterArrayOrSingleton(textelr.STRUCT?.LIEN_ART)] as lienArt} {@const article = data.article?.[lienArt["@id"]]} {#if article !== undefined} {/if} {/each} -{:else if textelr.STRUCT.LIEN_ART !== undefined} +{:else if textelr.STRUCT?.LIEN_ART !== undefined} {/if} -{#each [...iterArrayOrSingleton(textelr.STRUCT.LIEN_SECTION_TA)] as lienSectionTa} +{#each [...iterArrayOrSingleton(textelr.STRUCT?.LIEN_SECTION_TA)] as lienSectionTa} {@const sectionTa = data.section_ta?.[lienSectionTa["@id"]]} {#if sectionTa !== undefined} diff --git a/src/lib/legal/index.ts b/src/lib/legal/index.ts index fe43dfa..0b24646 100644 --- a/src/lib/legal/index.ts +++ b/src/lib/legal/index.ts @@ -457,7 +457,7 @@ export interface Textelr { META_TEXTE_CHRONICLE: MetaTexteChronicle } } - STRUCT: { + STRUCT?: { LIEN_ART?: LienArt | LienArt[] LIEN_SECTION_TA?: LienSectionTa | LienSectionTa[] } diff --git a/src/lib/server/aggregates.ts b/src/lib/server/aggregates.ts index 309bdc2..762b5b4 100644 --- a/src/lib/server/aggregates.ts +++ b/src/lib/server/aggregates.ts @@ -65,7 +65,7 @@ export class Aggregator { this.textekali[id] = textekali if (this.follow.has("STRUCT.LIEN_ART.@id")) { - for (const lien of iterArrayOrSingleton(textekali.STRUCT.LIEN_ART)) { + for (const lien of iterArrayOrSingleton(textekali.STRUCT?.LIEN_ART)) { this.requestId(lien["@id"]) } } @@ -84,13 +84,15 @@ export class Aggregator { this.textelr[id] = textelr if (this.follow.has("STRUCT.LIEN_ART.@id")) { - for (const lien of iterArrayOrSingleton(textelr.STRUCT.LIEN_ART)) { + for (const lien of iterArrayOrSingleton(textelr.STRUCT?.LIEN_ART)) { this.requestId(lien["@id"]) } } if (this.follow.has("STRUCT.LIEN_SECTION_TA.@id")) { - for (const lien of iterArrayOrSingleton(textelr.STRUCT.LIEN_SECTION_TA)) { + for (const lien of iterArrayOrSingleton( + textelr.STRUCT?.LIEN_SECTION_TA, + )) { this.requestId(lien["@id"]) } }