-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5 Support #90
Comments
Hi! Can you elaborate on how would Svelte 5's runes replace the functionalities of this library? I'm interested because I've been developing an application with Svelte 3 and thinking about upgrading. I've also been considering using this library to simplify my stores' logic. Thanks! |
@thanhnguyen2187 You should be able to use this library as-is in Svelte 4 and 5. The $stores API: // Adding new array values (Svelte 4 & 3)
let myStore = [];
myStore.push(newValue);
myStore = myStore // Need to trigger reactivity 🫤
// OR
myStore = [...myStore, newValue]
// Adding new array values (Svelte 5)
let myStore = $state([]);
myStore.push(newValue); // fine-grained reactivity 🤯 My backend only sends the updated or new record for efficiency so then I can just |
Sorry for the late reply, but what I mean was // "vanilla" store
async function createCustomVanillaStore() {
underlyingStore = writable([])
fetch(...).then(underlyingStore.set)
return underlyingStore
}
// `asyncDerived`
const niceStore = asyncDerived([], async () => { return fetch(...) }) My question is: how would we achieve the same result with runes? Would it be something like: $derived.by(() => fetch(...).json()) Which is a promise and I think is not as nice. |
Svelte 5 will be released sometime this year with the new runes API (Preview Docs) and while
stores
are not deprecated,$runes
will allow you to do all the same things. So, are there plans to eventually support Svelte 5 when it's officially released? I really like this package's ideas and its svelte API compared to the competitors and hope it stays maintained ❤️The text was updated successfully, but these errors were encountered: