-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
fix: always call tick() if defined in transitions #12883
Conversation
|
Thank you. To answer the TODO: we do want What we don't want is for the event to be called twice, so I've added some code that removes the callback once it's been called. Right now, that new code isn't actually doing anything though, because of a subtle bug made visible by the test I just added: because the Separately, as a result of this PR we're no longer handling the case where neither |
But I think this case should be handled, unless you want breaking changes from Svelte 4, where that is allowed, and used by Skeleton to dynamically disable transitions: export function dynamicTransition<T extends Transition>(node: Element, dynParams: DynamicTransitionParams<T>): TransitionConfig {
const { transition, params, enabled } = dynParams;
if (enabled) return transition(node, params);
// it's better to just set the `duration` to 0 to prevent flickering
if ('duration' in params) return transition(node, { duration: 0 });
// if the transition doesn't provide a `duration` prop, then we'll just return this as a last resort
return { duration: 0 };
} |
Fair enough. My point is that it was handled prior to this PR — if you modify that example to include a duration, then nothing transitiony happens when you toggle the button, but the element removal is nonetheless delayed. That's true on |
Perhaps the fix here is to remove the completion logic from the |
...though that's arguably suboptimal since it means we're adding work on every |
I figured it out: we need to use WAAPI to control |
Closes #12730
Call
tick()
if it's defined, not ifcss
is undefined.Note for maintainers: the call to
on_finished()
used to be wrapped inif (!css)
, was it intended for it to never be called for CSS transitions? Regardless I left it as-is as I'm not sure + added a TODO, now it's only called whentick
is defined instead.Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint