-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Outros undefined when transitioning to another page #3165
Comments
I'm having the same issue. To reproduce it you can clone Svelte Firebase and Svelte Router SPA and update the Svelte dependency to anything above 3.5.1 (latest version tested 3.6.1) I had to lock up the Svelte version to 3.5.1 because of that. |
@jorgegorka |
@matyunya It works perfect. |
@jorgegorka Great! Well, let's hope it gets merged! |
Is anyone able to create a simple repro? The repos mentioned above seem to have some additional setup requirements. If someone can create a REPL demo that'd be ideal. I'd rather we can understand the root issue and fix it rather than working around it 😀 |
So far I only got that the problem occurs when the unmounting component is third party. That is importing locally a component with exactly same code has no issues. |
is mistakenly set to true in |
@Rich-Harris @matyunya I was trying to create a simple repo and I noticed that in Svelte 3.6.4 the problem is gone. Last time I checked was with version 3.6.1. |
I still get it if I try to import a component like this from a third party package.
|
I'm also getting this issue as of the 3.6.4 release on a sapper project. I'm not using a component from a third party package. Unfortunately, I don't have a simple repro. I do have some descriptions of state with SSR, a conditional using a store, & a child component. This causes the issue. I completely emptied out {#if !$__hide__header}
<header>
<div class="container">
<Nav></Nav>
</div>
</header>
{/if} This does not cause the issue. {#if !$__hide__header}
<header>
<div class="container">
</div>
</header>
{/if} The In SSR, |
Is this issue still live or is it fixed as of 3.6.7? |
I've updated Svelte to 3.6.7 and the problem is back `
`
|
it's fixed for me. @jorgegorka can you upload your repo? |
I think I've found the issue. There was a mismatch between the Svelte version required by Svelte Router SPA and the version in my repo. Now both are using 3.6.7 and all is good again. |
let's mark it D O N E |
Still getting this exact issue on 3.6.7. Only happens on external components (yarn linked in this case), if i use local components issue is resolved. Can't recreate in REPL. I've double checked all versions of Svelte are the same. Built using Webpack 4, yarn 1.16.0 and node v12. This one is NASTY! |
If it only happens with linked components, it's probably not the same issue. This should be fixed now in the Rollup versions of the templates, but I haven't looked into webpack yet. There's a comment here that sounds helpful. |
I've recreated the issue in this repro... https://github.com/rob-balfre/svelte-slot-example it will show you the error when you click on the button. Was nothing to do with yarn link. @Conduitry thanks for the link will take a look. |
https://github.com/sveltejs/svelte-loader#resolvemainfields You need I'm surprised this wasn't in the template yet in https://github.com/sveltejs/template-webpack/blob/master/webpack.config.js - I'll add it. |
@Conduitry but webpack doesn't compile if you add a
|
Oops, you also need to remove the |
Worked on my test-repo but not in my actual app 🤦It has a more complicated component lib setup. Can't we just add a catch like |
We need a minimal reproduction. |
Ok can finally reproduce, only happens with yarn link!!! Clone https://github.com/rob-balfre/svelte-slot-example and https://github.com/rob-balfre/fake-component-lib Run yarn install and yarn link in fake-component-lib Then in svelte-slot-example run yarn install, yarn link fake-component-lib and yarn dev. Click on the hide button and error shows. |
If it only appears when linking dependencies, see this comment from earlier. |
BOOOM! Just needed...
Thanks @Conduitry Hmm Do you think there is way to make it bit more friendlier though? The error message isn't very helpful. |
@dimfeld ok nevermind it worked. My problem was that I installed my dependency for development like |
Hello, not sure why this issue is closed. Seems to still be a problem (using webpack and sapper). I've tried almost all of the solutions on this page and the only one working for me is from @QuickMick
|
I'm still getting this error on |
I've triggered this a couple of times with svelte-kit also. Not sure what the reason is, but at least the error message could be better... Setting I started debugging this by checking out commits in the history, and when I went back to the version that produces the error, the error no longer happens. Bizarre... |
I've solved this bizarrely using
in webpack config |
same problem for me:
with "svelte": "^3.0.0" and rollup. I wanted to make a moduler design. I compiled main.js and bunch of apps seperately and individually. ...
// an app.js
const register = new CustomEvent(
"REGISTER_APP",
{
bubbles: true,
detail: appComponent,
}
)
document.dispatchEvent(register); main.js listens these app register events and render a tab for each app. ...
function transition_out(block, local, detach, callback) {
if (block && block.o) {
if (outroing.has(block))
return;
outroing.add(block);
outros.c.push(() => { // this push part gives the error
outroing.delete(block);
if (callback) {
if (detach)
block.d(1);
callback();
}
});
block.o(local);
}
}
... any solution for this type of situation? EDIT: temporary solution ...
- outros.c.push(() => { // this push part gives the error
+ outros?.c?.push(() => {
... |
Error outlined here sveltejs/svelte#3165, and there is no fix, so I just avoided having a conditional slot, and just rerouted to an installMetaMask page instead.
Same problem here using the latest Svelte version... Should re-open this issue? |
@alanleite I had the same issue and found that it was fixed by reverting to |
Still having this issue with webpack and rollup(3.35.0), consuming an external component, if wrapped in a IF clause, it will produce the outro error, even tho we are not using a transition animation. |
While it doesn't address the root of the problem- out of curiousity- is there a particular reason why checking for c first is a bad idea? Would something like |
in my code, this was caused, because i had a second package, containing some of my abstract components and i think, i had a different versions of svelte in it.
|
I also ran into this while working on a hot-reloading of external svelte components. The scenario is this: I have a page that dynamically loads external components via <!-- Component.svelte -->
<script>
import { onMount } from 'svelte';
export let path;
let component;
onMount(() => {
// error triggered by this line:
window.subscribeHotReload(path, () => loadComponent(path));
loadComponent(path);
});
function loadComponent(path) {
require([`/lib/csr/${path}.js?c=${Math.round(1e6 * Math.random())}`], mod => {
component = mod;
});
}
</script>
{#if component}
<svelte:component this={component} />
{/if} In my setup, the compiled Svelte builds are coming from the exact same rollup version & config. Now I've tried to add hot-reloading using the Not sure if this is helping, but I thought it's worth leaving here. |
I encountered this issue 7 months ago. I can't believe it's still around now. This time it was because of the package carbon-components-svelte. When I use a component from their package, outros.c.push was sometimes undefined. The solution from ulvido work well for me at least.
|
…344) * add location to csv * add dedupe to rollup config Prevents issue caused by two internal svelte instances loaded when using npm link (see: sveltejs/svelte#3165) * reset searchQuery if value is reset externally * delete rows from CSV * publish @datawrapper/[email protected] * install @datawrapper/[email protected] * create build * onLocationSelect -> selectLocation * don't show helper message when there is no input * publish and install @datawrapper/[email protected] * add comments about different datasets * add flashRow method * try not removing flash cell data and class as it doesn't seem needed * use before pseudo-element so that cell background stays the same * adjust css * change pseudo-element to after to avoid conflicts with other existing styles * react to change in first row as label * onRowsDelete -> deleteRows * call flashRow after adding location * use visualRow instead of row * account for horizontal header * remove flash class in the end * build * publish and install @datawrapper/[email protected] Co-authored-by: ilokhov <[email protected]>
Ok, so I see a pattern to hone in on: I can tell that some of these errors are with routers, SPA routers specifically. For a router to transition between pages, it must use an @Conduitry let me know if this Svelte or router specific, please. Here are my dependencies relevant to the issue: {
"dependencies": {
"svelte-router-spa": "^6.0.3"
},
"devDependencies": {
"@symfony/webpack-encore": "^2.1.0",
"svelte": "^3.39.0",
"svelte-loader": "^3.1.2"
}
} My webpack config is for Encore.addLoader({
test:/\.svelte$/,
loader:'svelte-loader',
}) |
…344) * add location to csv * add dedupe to rollup config Prevents issue caused by two internal svelte instances loaded when using npm link (see: sveltejs/svelte#3165) * reset searchQuery if value is reset externally * delete rows from CSV * publish @datawrapper/[email protected] * install @datawrapper/[email protected] * create build * onLocationSelect -> selectLocation * don't show helper message when there is no input * publish and install @datawrapper/[email protected] * add comments about different datasets * add flashRow method * try not removing flash cell data and class as it doesn't seem needed * use before pseudo-element so that cell background stays the same * adjust css * change pseudo-element to after to avoid conflicts with other existing styles * react to change in first row as label * onRowsDelete -> deleteRows * call flashRow after adding location * use visualRow instead of row * account for horizontal header * remove flash class in the end * build * publish and install @datawrapper/[email protected] Co-authored-by: ilokhov <[email protected]>
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:
At this line:
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.The text was updated successfully, but these errors were encountered: