From 621d3c608d7021d16386dacf34b34161b0447594 Mon Sep 17 00:00:00 2001
From: David Smadja <david.smadja@assemblee-nationale.fr>
Date: Mon, 24 Feb 2025 14:06:01 +0100
Subject: [PATCH] prevent bug https://github.com/sveltejs/svelte/issues/15316

---
 src/lib/components/variables/VariableInput.svelte | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lib/components/variables/VariableInput.svelte b/src/lib/components/variables/VariableInput.svelte
index 9bf63c434..4ee97dc29 100644
--- a/src/lib/components/variables/VariableInput.svelte
+++ b/src/lib/components/variables/VariableInput.svelte
@@ -370,18 +370,18 @@
                     year,
                   )}
                 {:else}
+                  {@const value = getSituationVariableValue(
+                    situation,
+                    variable,
+                    populationId,
+                    year,
+                  )}
                   <!-- Input menu sélection -->
-
                   <select
                     class="my-1 w-full rounded border-none bg-white p-1 pr-10 shadow-sm focus:border-le-bleu focus:text-le-bleu"
                     onblur={(event) => changeValue(event, populationId)}
                     onchange={(event) => changeValue(event, populationId)}
-                    value={getSituationVariableValue(
-                      situation,
-                      variable,
-                      populationId,
-                      year,
-                    )}
+                    {value}
                   >
                     {#each Object.entries(variable.possible_values) as [symbol, label]}
                       <option value={symbol}>{label}</option>
-- 
GitLab