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

Illegal invocation on:click in #each #14667

Open
alexisgaillard43 opened this issue Dec 11, 2024 · 1 comment
Open

Illegal invocation on:click in #each #14667

alexisgaillard43 opened this issue Dec 11, 2024 · 1 comment
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@alexisgaillard43
Copy link

alexisgaillard43 commented Dec 11, 2024

Describe the bug

I'm building search drop-downs, and encounter the error "Uncaught TypeError: Illegal invocation" when clicking in the list. The list's array - users - is generated dynamicaly from an API call response.

Reproduction

function addOwnership({ payload }: { payload: SelectedOwnershipsOptions }): void {
  ...
};


{#if panelVisibility}
  <div transition:fade={{ duration: 220 }} >
    {#each users as { userId, username, verified, avatar, role, ownership, skills } (userId)}
      <button on:click|preventDefault={() => addOwnership({ userId, username, verified, role, ownership })} >
        <AvatarThumbnail
          avatar={{
            avatar,
            title: username
          }}
       />
       ...
     </button>
   {/each}
  </div>
{/if}

Logs

Uncaught TypeError: Illegal invocation

System Info

Svelte Kit with Svelte 4.2.1

Severity

annoyance

@paoloricciuti
Copy link
Member

This is not a reproduction: please provide a link to the svelte repl or a sveltelab/stackblitz or a github repo with the actual problem reproduced (also the more minimal your reproduction the faster we can fix this problem).

Thanks for reporting 😃

@paoloricciuti paoloricciuti added the awaiting submitter needs a reproduction, or clarification label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
Development

No branches or pull requests

2 participants