From 9b4b9982d0ed82e49cbb3f0b117d0d3618ee58ef Mon Sep 17 00:00:00 2001 From: Theis Pieter Hollebeek Date: Thu, 12 Dec 2024 12:12:46 +0100 Subject: [PATCH] fix entry rendering --- web/public/src/data.ts | 2 +- web/public/src/index.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/web/public/src/data.ts b/web/public/src/data.ts index 484b7bc..fcc4ed6 100644 --- a/web/public/src/data.ts +++ b/web/public/src/data.ts @@ -27,5 +27,5 @@ export type CodeCovEntry = { export async function codeCoverageData(): Promise { return await fetch("/api/code-coverage") .then((v) => v.json()) - .then((v) => v.codeCoveragea); + .then((v) => v.codeCoverage); } diff --git a/web/public/src/index.ts b/web/public/src/index.ts index 8a6555c..4547f4f 100644 --- a/web/public/src/index.ts +++ b/web/public/src/index.ts @@ -2,11 +2,14 @@ import * as data from "./data.ts"; function loadCodeCoverage( text: string, - data: data.CodeCovEntry[], + input: data.CodeCovEntry[], container: HTMLPreElement, tooltip: HTMLElement, ) { - const entries = data.toSorted(( + if (input.length === 0) { + return; + } + const entries = input.toSorted(( a: data.CodeCovEntry, b: data.CodeCovEntry, ) => b.index - a.index);