profile
viewpoint

Ask questionsOutros undefined when transitioning to another page

Couldn't get a REPL repro but If I try to navigate from https://smelte-8z4ib07lj.now.sh/components/tabs to any other page I get this error:

index.mjs:629 Uncaught (in promise) TypeError: Cannot read property 'callbacks' of undefined
    at U (index.mjs:629)
    at Object.o (Waypoint.svelte:116)
    at hn (index.mjs:761)
    at Object.o (Image.svelte:27)
    at hn (index.mjs:761)
    at Object.o (tabs.c766b77c.js:1)
    at hn (index.mjs:761)
    at Object.o (TabButton.svelte:11)
    at hn (index.mjs:761)
    at Object.o (Tab.svelte:6)
</details>

At this line:

function transition_out(block, local, callback) {
    if (block && block.o) {
        if (outroing.has(block))
            return;
        outroing.add(block);
        **outros.callbacks.push(() => {**
            outroing.delete(block);
            if (callback) {
                block.d(1);
                callback();
            }
        });
        block.o(local);
    }
}

Works https://smelte-8z4ib07lj.now.sh/components/tabs

Doesn't https://smelte-ocubxglhw.now.sh/components/tabs

Not sure what causes the error so I simply patched it by adding an extra check if outros.callbacks is set.

sveltejs/svelte

Answer questions jorgegorka

I've updated Svelte to 3.6.7 and the problem is back

` Uncaught (in promise) TypeError: Cannot read property 'c' of undefined

at transition_out (index.mjs:630)
at Object.outro [as o] (index.svelte:31)
at transition_out$1 (index.mjs:634)
at Object.outro [as o] (route.svelte:8)
at transition_out$1 (index.mjs:634)
at Object.update [as p] (route.svelte:9)
at update$1 (index.mjs:584)
at flush$1 (index.mjs:558)

`

function transition_out(block, local, detach, callback) {
    if (block && block.o) {
        if (outroing.has(block))
            return;
        outroing.add(block);
     ===>   outros.c.push(() => {    <=====
            outroing.delete(block);
            if (callback) {
                if (detach)
                    block.d(1);
                callback();
            }
        });
        block.o(local);
    }
}
useful!
source:https://uonfu.com/
answerer
Jorge Alvarez jorgegorka Xing Logroño, Spain https://www.alvareznavarro.es Web developer at New Work SE (Xing). Creator of happymoodscore.com
Github User Rank List