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

loading state for collection reference #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anasmohammed361
Copy link

When using Collection , We dont trigger the loading state , as the initial value in never undefined.

  • Added the initial value as undefined in collection store.

#96

#140

#142

@nickt28
Copy link

nickt28 commented May 17, 2024

@codediodeio I am having the same issue, how come this hasn't been resolved yet. I spent a while reading the code to find a solution. Why not make the count prop start at -1 or allow startWith={undefined} to pass on the undefined state. A 5min fix.

I have created this hack:

<Collection ref={'taskLists'} let:data={taskLists} startWith={[{ loading: true }]} let:count={taskListCount}>
  {#if taskLists[0]?.loading}
    <Loading />
  {:else}
    <showTasks tasks={taskLists} />
  {/if}
  // Useless
  <svelte:fragment slot="loading"></svelte:fragment>
</Collection>

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

Successfully merging this pull request may close these issues.

None yet

2 participants