Closed Pasithea0 closed 2 days ago
Hi, I'm not able to try this myself at the moment, but I would suggest to try the following:
$state("")
without any attempt at caching the markdown;$state(localStorageStore.get("markdown") || "")
, keep $state("")
and move the retrieval of the cached content to an onMount
call:
let source = $state("");
onMount(() => {
const cached = localStorageStore.get("markdown") ;
if (cached) source = cached;
})
Ah! I didn't think to do that, that did the trick though!
let source = $state("");
onMount(() => {
const cached = localStorageStore.get("markdown") ;
if (cached) source = cached;
})
$effect(() => {
localStorageStore.set("markdown", source);
});
I just added the $effect to update changes!
I'm trying to migrate my code to Svelte 5, but when reloading the page the styles do not load.
Here is my relevant code:
https://github.com/user-attachments/assets/22de92c6-5f86-4416-af6a-d0fc3273e24d