fix for data not updating first time

This commit is contained in:
2023-01-21 19:34:54 +09:00
parent c363f88242
commit ad7fc65154

View File

@@ -3,6 +3,13 @@
import AutoComplete from "simple-svelte-autocomplete"; import AutoComplete from "simple-svelte-autocomplete";
import DisplayData from "./DisplayData.svelte"; import DisplayData from "./DisplayData.svelte";
$: { $: {
if (myValue > 0 && myValue !== currentValue) {
invoke("search", { index: myValue }).then((r) => {
currentValue = myValue;
pokemonData = r;
console.log(pokemonData);
});
}
pokemonStatus = { pokemonStatus = {
types: pokemonData?.types ? pokemonData.types : [], types: pokemonData?.types ? pokemonData.types : [],
hp: hp_final, hp: hp_final,
@@ -42,15 +49,6 @@
return []; return [];
} }
} }
$: {
if (myValue > 0 && myValue !== currentValue) {
invoke("search", { index: myValue }).then((r) => {
currentValue = myValue;
pokemonData = r;
console.log(pokemonData);
});
}
}
</script> </script>
<div> <div>