-
Notifications
You must be signed in to change notification settings - Fork 43
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
Button issue - le is undefined when links followed #18
Comments
Looking into it; thanks for the repro repo. |
I think this may be fixed by this: sveltejs/svelte#3159 It fixed the docs navigation bug. Going to try. Update 1: Not fixed, furthermore when I Update 2: The errors I'm seeing with unminified source point to issues with transition outros being undefined. My hunch is that this is related to sveltejs/svelte#3166 and |
@rohfle Looks like it's still happening with svelte-spa-router >= 1.2.0 |
I'm also getting this with svelte-spa-router 1.2.0 and svelma 0.3. |
So I dug into this a little bit more because it puzzled me: Console trace Relevant code let outros$1;
function group_outros$1() {
outros$1 = {
r: 0,
c: [],
p: outros$1 // parent group
};
console.log('group_outros$1', outros$1)
}
function check_outros$1() {
if (!outros$1.r) {
run_all$1(outros$1.c);
}
outros$1 = outros$1.p;
console.log('check_outros$1', outros$1)
}
function transition_in$1(block, local) {
if (block && block.i) {
outroing$1.delete(block);
block.i(local);
}
}
function transition_out$1(block, local, detach, callback) {
console.log('transition_out$1', outros$1, 'block', block)
if (block && block.o) {
if (outroing$1.has(block))
return;
outroing$1.add(block);
outros$1.c.push(() => { // THIS IS WHERE THE ERROR HAPPENS
outroing$1.delete(block);
if (callback) {
if (detach)
block.d(1);
callback();
}
});
block.o(local);
}
} Notes
group_outros(); // creates a outros object with existing outros as parent
transition_out(); // calls a blocks outro function
b1.o() // outros function for block if there is one
check_outros(); // makes outros parent the outros object
group_outros();
transition_out();
b1.o(); // outros function for block b1
group_outros();
transition_out(); // this one is ok
transition_out();
b2.o(); // outros function for sub block b2
// group_outros$1() is not called
transition_out$1(); // this is where the error happens for block b3
// check_outros$1() is not called
check_outros(); // code never gets here
check_outros() It seems there are two different sveltes running with different transition functions and global variables - one that is part of the repro repo and one that is part of the svelma bundle. Could this be why the issue is occurring? I tried compiling Svelma from source using rollup with terser turned off. The above naming with $1s are renames automatically performed by rollup to prevent name conflict. On the minified code it just has random functions, but they are still distinct from the repro repo ones. Note that svelte-spa-router is just raw .svelte code that gets imported by the repro repo. Perhaps svelma has to switch to using the same thing? (Use svelte straight from source, not precompiled) EDIT: similar to issue #29 - kroshilin's proposed PR #31 fixes the issue in the repro repo successfully! |
Hello,
Summary
I am using
svelma
andsvelte-spa-router
for a project and I am having an issue where having a svelma button on a page will cause the page to error when links are followed.POC
Here is an example project that reproduces the issue: https://github.com/rohfle/svelma-button-issue-poc
Details
When I import using
import { Button } from 'svelma'
, I get the following error when I click a link to take me to another page:console.log(Button)
gives me:When I import using
import Button from 'svelma/src/components/Button.svelte'
, I get no error andconsole.log(Button)
gives me:The text was updated successfully, but these errors were encountered: