From fb19811cf89c64517865ba85437115b674a09c56 Mon Sep 17 00:00:00 2001 From: Conor Barnes Date: Thu, 25 Apr 2024 21:42:28 +0100 Subject: [PATCH] fix broken loads --- src/lib/components/InternalLink.svelte | 2 +- src/lib/funcs/collectionsDataTransform.ts | 2 +- src/lib/funcs/metaculusDataTransform.ts | 2 +- src/lib/funcs/predictDataTransform.ts | 2 +- src/routes/+page.server.ts | 12 +++++--- src/routes/+page.svelte | 37 ++++++++++++----------- src/routes/collection/+page.server.ts | 9 +++--- src/routes/collection/+page.svelte | 24 +++++++-------- svelte.config.js | 7 +++-- 9 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/lib/components/InternalLink.svelte b/src/lib/components/InternalLink.svelte index 6e9bc79..040d100 100644 --- a/src/lib/components/InternalLink.svelte +++ b/src/lib/components/InternalLink.svelte @@ -2,6 +2,6 @@ export let href: string; - diff --git a/src/lib/funcs/collectionsDataTransform.ts b/src/lib/funcs/collectionsDataTransform.ts index 66c0664..14442c4 100644 --- a/src/lib/funcs/collectionsDataTransform.ts +++ b/src/lib/funcs/collectionsDataTransform.ts @@ -41,5 +41,5 @@ function outcomeTransform(outcome: { name: string; probabilities: GoodOutcome | } export default function entryTransform(outcomes: Outcomes): TreeData { - return { name: '2022', children: outcomes.map((o) => outcomeTransform(o)) }; + return { name: '2024', children: outcomes.map((o) => outcomeTransform(o)) }; } \ No newline at end of file diff --git a/src/lib/funcs/metaculusDataTransform.ts b/src/lib/funcs/metaculusDataTransform.ts index 952fb8e..b93f067 100644 --- a/src/lib/funcs/metaculusDataTransform.ts +++ b/src/lib/funcs/metaculusDataTransform.ts @@ -14,7 +14,7 @@ export default function metaculusDataTransform(vals: { bioX: number; }): TreeData { const transformed = { - name: '2022', + name: '2024', children: [ { name: 'climate', diff --git a/src/lib/funcs/predictDataTransform.ts b/src/lib/funcs/predictDataTransform.ts index faaad4c..42138fd 100644 --- a/src/lib/funcs/predictDataTransform.ts +++ b/src/lib/funcs/predictDataTransform.ts @@ -21,5 +21,5 @@ export default function selfDataTransform( .flat() }; }); - return { name: '2022', children: ch }; + return { name: '2024', children: ch }; } diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index a1fea3f..56d0969 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -1,5 +1,3 @@ -import type { RequestHandlerOutput } from '@sveltejs/kit'; - async function metaculusFetch(question: number): Promise { if (process.env.NODE_ENV === 'production') { const res = await fetch(`https://www.metaculus.com/api2/questions/${question}`); @@ -22,7 +20,8 @@ function makeRelative(total: number, particular: number, xRisk: number) { return [roundedParticular, roundedXRisk]; } -export async function load(): Promise { +/** @type {import('./$types').PageServerLoad} */ +export async function load(): Promise { // GET THE DATA // By 2100 will the human population decrease by at least 10% during any period of 5 years? const totalQuestion = metaculusFetch(1493); @@ -95,7 +94,10 @@ export async function load(): Promise { console.log('BUILD COMPLETE'); // make sure this only logs during build, not runtime. return { - vals, - time: new Date().toString() + props: { + vals, + time: new Date().toString(), + test: 'fake' + } }; } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a6149c6..68a663f 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,5 +1,4 @@