Skip to content
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

Documentation: asyncWritable initial value? #12

Closed
sanderjson opened this issue Jun 27, 2022 · 0 comments
Closed

Documentation: asyncWritable initial value? #12

sanderjson opened this issue Jun 27, 2022 · 0 comments

Comments

@sanderjson
Copy link

sanderjson commented Jun 27, 2022

How do I set an initial value in an asyncWritable?

I have read in the docs:

asyncWritable

Our first two arguments work just like an asyncDerived store--we can pass any number of stores and we can use their values to set the value of the store once the parents have loaded.

asyncDerived

However, while regular derived stores will invoke that function whenever any of the parent values changes (including initialization) an asyncDerived store will only do so after all of the parents have finished loading.

Intended use:

{#await my_store.load() then}
	<ul>
	    {#each $my_store as val}
	      <li>
	        {...val}
	      </li>
	    {/each}
	</ul>
{/await}

And sometimes getting the error Uncaught (in promise) Error: {#each} only iterates over array-like objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant