Svelte: bug with select_block_type function

Created on 26 Feb 2018  Â·  5Comments  Â·  Source: sveltejs/svelte

We have code wich work perfect in 1.54.1 version. But in 1.56 this code not working.

Exampes:

function select_block_type in new version not get header argument

function select_block_type(state) {
    if (!header.icon) return create_if_block_2;
    return create_if_block_3;
}
bug

Most helpful comment

Fixed in 1.56.1 — thanks all

All 5 comments

Was just preparing a REPL about the same problem:

Throws "item is not defined" - seems to happen when using {{else}} inside {{#each}}. If the {{else}} is removed, no error is thrown.

Works fine with 0.55.

It _looks_ like the issue is right here (and also right here). The code is attempting to use values from state without actually retrieving them from the state object. I'm taking a peek at this, but all of this code was heavily refactored for 1.56.0 and so I'm not very familiar with it yet.

It looks like you identified the issue, but in case it's helpful I was running into the same problem with {{else}} inside {{#await}}: 1.55.1 vs 1.56.0. I'm assuming this goes back to the same thing.

Here is the most minimal test case with just a single {{#each}} and {{#if}}-{{else}} I could build: 1.55.1 vs 1.56.0.

Fixed in 1.56.1 — thanks all

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matt3224 picture matt3224  Â·  3Comments

clitetailor picture clitetailor  Â·  3Comments

davidcallanan picture davidcallanan  Â·  3Comments

Rich-Harris picture Rich-Harris  Â·  3Comments

st-schneider picture st-schneider  Â·  3Comments