diff --git a/src/lib/components/variables/InflationLawButton.svelte b/src/lib/components/variables/InflationLawButton.svelte index 6fd418d69b1db9f137b8af8147931e73b497303d..f0044d98953681b1186c0d367f24e1422e35867b 100644 --- a/src/lib/components/variables/InflationLawButton.svelte +++ b/src/lib/components/variables/InflationLawButton.svelte @@ -20,24 +20,31 @@ reformName, { ...reformParameter, - values: Object.fromEntries([ - ...Object.entries(reformParameter.values), - [ - "latest", - Object.entries(reformParameter.values).sort( - ([instant1], [instant2]) => instant2.localeCompare(instant1), - )[0][1], - ], - ]), + values: + reformParameter.values === undefined + ? undefined + : Object.fromEntries([ + ...Object.entries(reformParameter.values), + [ + "latest", + Object.entries(reformParameter.values).sort( + ([instant1], [instant2]) => + instant2.localeCompare(instant1), + )[0][1], + ], + ]), }, ], ), ) // Latest inflator - $: billInflator = inflatorWithLatestByReformName?.[$billName] + $: billInflator = + $billName === undefined + ? undefined + : inflatorWithLatestByReformName?.[$billName] $: billInflatorValueFormatted = - billInflator !== undefined + billInflator?.values !== undefined ? formatValue(billInflator.values["latest"].value, billInflator.unit) : undefined </script>