-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
#2668 - Add null-checks in on_outro callback for IfBlock #2717
Conversation
Thanks, this is an excellent test case and a compact fix. It feels like there might be a deeper bug here — normally, I don't think it's possible to have 'nested' groups of outros. At least, if I modify transitions.js like so... +let grouping = false;
+
export function group_outros() {
+ if (grouping) {
+ throw new Error('already grouping');
+ }
+
+ grouping = true;
+
outros = {
remaining: 0,
callbacks: []
};
}
export function check_outros() {
+ grouping = false;
+
if (!outros.remaining) {
run_all(outros.callbacks);
}
} ...then the only test that fails is the one in this PR. So I wonder if there's an alternative fix that renders the null check unnecessary? (Unfortunately my brain is only capable of asking the question right now, not delivering the answer. It's very possible that I'm barking up the wrong tree.) |
@Rich-Harris, thank you for reply. +let n = 0;
+
export function group_outros() {
+ if (n++ > 1) {
+ return; // already grouping
+ }
+
outros = {
remaining: 0,
callbacks: []
};
}
export function check_outros() {
+ if (n-- > 1) {
+ return; // skip inner calls
+ }
+
if (!outros.remaining) {
run_all(outros.callbacks);
}
} In that case tests passed without null checks in outro callbacks. But unfortunately in that case 'out' animations are broken because nested blocks are still not detached when I will continue investigating and share example with animations in separate repository a little bit later. |
I made a repository with an list animations example. |
@IOuser is this ready to be looked into? @Rich-Harris Could you give this PR another look? |
The underlying issue is closed, having (apparently) been fixed by #3172, so I'll close this PR. Thanks |
#2668