Closed absowoot closed 11 months ago
Could you send a bit of code of what you have and maybe some pseudocode of what you're trying to accomplish?
Thanks for following up. Figures -- as I was writing out the issue I was able to figure it out.
For anyone who stumbles upon this in the future, I was able to use Svelecte and live_svelete by doing:
<script>
import Svelecte from "svelecte/src/Svelecte.svelte";
export let live;
export let suggestions;
const fetch = (query) => {
return new Promise((resolve) => {
live.pushEvent("get-suggestions", { search: query }, () => resolve(suggestions));
});
};
</script>
<Svelecte valueAsObject {fetch} />
Thanks for posting your solution.
I'm working on a component that is using an autocomplete library. I've tried a few libraries (Svelecte, Svelte Select Svelte Simple Autocomplete) and they all use promises to populate the dropdowns, but I'm looking to use an internal phoenix function.
I was able to accomplish this using Svelte Select by watching for keydown but I wonder if there would be a way to utilize the built-in async functions in these libraries with live_svelte?