-
Notifications
You must be signed in to change notification settings - Fork 5
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
syncable #30
Comments
Hi! As I can see, your example works as expected. As may you know, promises resolving in next tick,
Your code looks a little bit strange to me, because seems you don't need to use |
Yah sorry I was trying to oversimplify a bit for the sake of the ticket. I'm new to using this lib and maybe I mis-understood how it might work My use case is to use this library as a cache for a successful network call to eliminate calling the same endpoint over and over again each time a UI needs the results. Also to provide "stateful" UI's so the users know if things are still loading or there was an error So say I create an There are a few places where I want the synchronous result of the promise because at that point in time I know this promise ran and theres active subscribers to the asyncable store. I dont want to force an async nature all the way up my call stack. Do you have a live example on how to use Is the |
Ok my co-worker and I looked into this a bit more. It looks like Heres an updated example |
Very basic example how to use it you can find here: https://svelte.dev/repl/068f31a5dc8b4a24998d28762bf2a790?version=4.0.5
This example work as expected as well. |
The primary issue I'm having is I'm using the result of the Thanks for this library though, I think its awesome! |
let value =
store.subscribe(($store) => value = $store)();
(1) first subscription occurred -> return initial value immediately -> (2) wait until resolving a promise -> return actual value -> (3) return any next updates if dependant store has changed Using As you can see,
|
I'm not sure the syncable example is working or I'm doing something wrong
I created this to demonstrate
https://codesandbox.io/s/sweet-surf-f2wq7y?file=/index.js
I would expect todosSync to display "my async value" not "bleh"
The text was updated successfully, but these errors were encountered: