Skip to content

Commit 8b3c6a7

Browse files
committed
fix: drapeau non reactif
1 parent 4b5192b commit 8b3c6a7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib/components/Flag.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import usFlag from '$lib/assets/us.svg';
44
import { englishLocale, frenchLocale } from '$lib/i18n';
55
import { locale, t } from 'svelte-i18n';
6+
import { derived } from 'svelte/store';
67
78
function otherLocaleIconUrl(): string {
89
if ($locale === frenchLocale) {
@@ -19,11 +20,13 @@
1920
$locale = frenchLocale;
2021
}
2122
}
23+
24+
const localeIcon = derived(locale, otherLocaleIconUrl);
2225
</script>
2326

2427
<button on:click={switchLocale}>
2528
<img
2629
alt={$t('changer-de-langue')}
27-
src={otherLocaleIconUrl()}
30+
src={$localeIcon}
2831
class="w-8" />
2932
</button>

0 commit comments

Comments
 (0)