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

if_block0.p is not a function #5789

Closed
Hoss3770 opened this issue Dec 15, 2020 · 7 comments · Fixed by #5849
Closed

if_block0.p is not a function #5789

Hoss3770 opened this issue Dec 15, 2020 · 7 comments · Fixed by #5849

Comments

@Hoss3770
Copy link

Hoss3770 commented Dec 15, 2020

Describe the bug
This Bug appears in Version 3.29.6
I assume that this is the breaking change: #5591

I have this code:

{#if fetching}
      <li transition:slide|local>
        <svg class=spinner viewBox="0 0 50 50">
          <circle cx=25 cy=25 r=20 fill=none stroke-width=5/>
        </svg>
      </li>
{:else if query && !data.length && !error}
      <div class=no-results>لا نتائج</div>
{/if}
{#if error}
      <div class=no-results>حدثت مشكلة في البحث، حاول لاحقًا</div>
{/if}

And removing <li transition:slide|local> fixes it.

Logs
When running the code and the if statement is triggered I get this error in chrome:

image

Here is the error after disabling source maps:

if (~current_block_type_index) {
     if_block0 = if_blocks[current_block_type_index];
     if (!if_block0) {
          if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
    	  if_block0.c();
      } else {
          if_block0.p(ctx, dirty);
     }
    transition_in(if_block0, 1);
    if_block0.m(ul, t5);
} else {
    if_block0 = null;
}

on the line if_block0.p(ctx, dirty); the error is marked

Information about your Svelte project:

  • I was able to reproduce the error on Chrome, Safari and Firefox

Severity
I just used another version for now

@Conduitry
Copy link
Member

Please provide a runnable reproduction, preferably in the REPL, along with the steps to reproduce it.

@awmcclain
Copy link

#5808 has a reproduction in a REPL for this same error.

@christiankaindl
Copy link

The problem seems to be the {:else if ...} block. Here's a repl which also experiences this bug:
https://svelte.dev/repl/044e92510a0f48b399f03bbdec25ef63?version=3.31.0

When quickly focusing<->unfocusing it breaks with the same error as is the reporters case.

Screen.Recording.2020-12-27.at.15.39.54.mov

Here is a "fix" (more a workaround) which instead of {:else if ...} uses two separate {#if} blocks and it works very well (doesn't break):
https://svelte.dev/repl/5ebd4f257f0a43be907153fce270743c?version=3.31.0

Screen.Recording.2020-12-27.at.15.38.50.mov

@Conduitry
Copy link
Member

This is fixed in 3.31.2 - https://svelte.dev/repl/044e92510a0f48b399f03bbdec25ef63?version=3.31.2

@braebo
Copy link
Member

braebo commented Aug 28, 2022

I just encountered this in version 3.49.0 with this monstrosity:

{#if gui.fftBufferArray}
  <pre>
    {#each audio ?? [] as a, i}
      {#if i > x}
        <p style="color: hsl(0, 50%, 50%)">{a}</p>
      {:else if i > y}
        <p style="color: hsl(100, 50%, 50%)">{a}</p>
      {:else if i > z}
        <p style="color: hsl(200, 50%, 50%)">{a}</p>
      {:else}
        <p style="color: hsl(0, 0%, 50%)">{a}</p>
      {/if}
    {/each}
    </pre>
{/if}

Going to use a {@const} block instead, but thought I would make note of this bug considering I haven't encountered it before today.

@Garito
Copy link

Garito commented Oct 25, 2022

This happen on 3.49.0 too

@x4fingers
Copy link

It still happens at 3.55.1.

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 a pull request may close this issue.

8 participants