From da62f8859b7bc5f171d2a209885daaef7a96bf7a Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Fri, 27 Nov 2020 13:54:25 +1300 Subject: [PATCH] remove stupid idea. --- webapp/src/routes/[id].svelte | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/webapp/src/routes/[id].svelte b/webapp/src/routes/[id].svelte index 53b0985..6f14155 100644 --- a/webapp/src/routes/[id].svelte +++ b/webapp/src/routes/[id].svelte @@ -6,18 +6,7 @@ const data = await res.json(); if (res.status === 200) { - const related = []; - const others = data.related.filter( - (r) => r.id !== data.story.id && !!r.num_comments - ); - for (const other of others) { - const r = await this.fetch(`${other.id}.json`); - if (r.ok) { - const d = await r.json(); - related.push(d.story); - } - } - return { story: data.story, related }; + return { story: data.story, related: data.related }; } else { this.error(res.status, data.message); } @@ -30,7 +19,7 @@ export let story; export let related; - let hasComments = story.num_comments || related.length; + let hasComments = related.some((r) => r.num_comments);