fix(dashboard): defensive null guard in ContributorStack; fix spec makeDoc factories

This commit is contained in:
Marcel
2026-04-19 19:22:52 +02:00
parent 0c65d5d748
commit 64c5b40eae
5 changed files with 12 additions and 2 deletions

View File

@@ -9,16 +9,18 @@ interface Props {
} }
let { contributors, hasMore }: Props = $props(); let { contributors, hasMore }: Props = $props();
const safeContributors = $derived(contributors ?? []);
</script> </script>
{#if contributors.length === 0} {#if safeContributors.length === 0}
<span <span
class="inline-block h-[22px] w-[22px] flex-shrink-0 rounded-full border-[1.5px] border-dashed border-[#cdcbbf]" class="inline-block h-[22px] w-[22px] flex-shrink-0 rounded-full border-[1.5px] border-dashed border-[#cdcbbf]"
title="Noch niemand angefangen" title="Noch niemand angefangen"
></span> ></span>
{:else} {:else}
<span class="inline-flex items-center"> <span class="inline-flex items-center">
{#each contributors as actor, i (actor.name ?? actor.initials + i)} {#each safeContributors as actor, i (actor.name ?? actor.initials + i)}
<span <span
class="inline-flex h-[22px] w-[22px] flex-shrink-0 items-center justify-center rounded-full font-sans text-[9px] font-bold text-white ring-2 ring-white {i > 0 ? '-ml-1.5' : ''}" class="inline-flex h-[22px] w-[22px] flex-shrink-0 items-center justify-center rounded-full font-sans text-[9px] font-bold text-white ring-2 ring-white {i > 0 ? '-ml-1.5' : ''}"
style="background-color: {actor.color || '#8c9aa3'};" style="background-color: {actor.color || '#8c9aa3'};"

View File

@@ -20,6 +20,8 @@ function makeDoc(
annotationCount: 0, annotationCount: 0,
textedBlockCount: 0, textedBlockCount: 0,
reviewedBlockCount: 0, reviewedBlockCount: 0,
contributors: [],
hasMoreContributors: false,
...overrides ...overrides
}; };
} }

View File

@@ -15,6 +15,8 @@ function makeDoc(overrides: Partial<TranscriptionQueueItemDTO> = {}): Transcript
annotationCount: 0, annotationCount: 0,
textedBlockCount: 0, textedBlockCount: 0,
reviewedBlockCount: 0, reviewedBlockCount: 0,
contributors: [],
hasMoreContributors: false,
...overrides ...overrides
}; };
} }

View File

@@ -15,6 +15,8 @@ function makeDoc(overrides: Partial<TranscriptionQueueItemDTO> = {}): Transcript
annotationCount: 0, annotationCount: 0,
textedBlockCount: 0, textedBlockCount: 0,
reviewedBlockCount: 0, reviewedBlockCount: 0,
contributors: [],
hasMoreContributors: false,
...overrides ...overrides
}; };
} }

View File

@@ -15,6 +15,8 @@ function makeDoc(overrides: Partial<TranscriptionQueueItemDTO> = {}): Transcript
annotationCount: 0, annotationCount: 0,
textedBlockCount: 0, textedBlockCount: 0,
reviewedBlockCount: 0, reviewedBlockCount: 0,
contributors: [],
hasMoreContributors: false,
...overrides ...overrides
}; };
} }