-
Couldn't load subscription status.
- Fork 89
Description
Describe the bug
@ef4 gave me a rough implementation of animated-outlet, so we could use this instead of liquid-fire. It was something like:
<AnimatedContainer class="h-full">
<AnimatedValue
@duration={{this.duration}}
@intialInsertion={{true}}
@key="outlets"
@rules={{this.rules}}
@value={{-get-dynamic-var "outletState"}}
as |outletState|
>
{{#-with-dynamic-vars outletState=outletState}}
<div class="h-full overflow-y-scroll w-full">
{{outlet}}
</div>
{{/-with-dynamic-vars}}
</AnimatedValue>
</AnimatedContainer>import Component from '@glimmer/component';
import fade from 'ember-animated/transitions/fade';
import { transitionOptions, transitions } from 'swach/transitions';
export default class AnimatedOutlet extends Component {
duration = transitionOptions.duration;
easing = transitionOptions.easing;
rules({ newItems, oldItems }: { newItems: any[]; oldItems: any[] }): unknown {
const oldRoute = oldItems[oldItems.length - 1];
const newRoute = newItems[newItems.length - 1];
let oldRouteName: string | undefined = undefined;
let newRouteName: string | undefined = undefined;
if (oldRoute) {
oldRouteName = oldRoute.outlets.main.render.name;
}
if (newRoute) {
newRouteName = newRoute.outlets.main.render.name;
}
let transition = transitions.find(
(t) => t.from === oldRouteName && t.to === newRouteName
);
if (transition) {
return transition.use;
}
transition = transitions.find(
(t) => t.to === oldRouteName && t.from === newRouteName
);
if (transition) {
return transition.reverse || transition.use;
}
if (oldRouteName !== newRouteName) {
return fade;
}
}
}This worked great in 0.12.0, but has some weird flashy behavior in 1.x. Any thoughts on what could be going on here or what changes I might need to make?
To Reproduce
As part of your reproduction, please fork the Ember Animated Boilerplate Twiddle then list the steps for the behavior.
Here's the Ember Animated Boilerplate Twiddle: https://ember-twiddle.com/d83c87fb8a7bdfa5a55b9a3c2bb4c2e5?openFiles=templates.application.hbs%2C
Steps to reproduce the behavior:
- Visit my Twiddle: '...'
- Click on '....'
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.