Handle case when this.element is undefined outlet

This commit is contained in:
Michael Klein 2022-10-05 12:32:48 +02:00
parent ef83c0799f
commit a6e4239e7d

View File

@ -79,10 +79,14 @@ export default class Outlet extends Component {
this.previousState = this.state; this.previousState = this.state;
this.state = new State('loading'); this.state = new State('loading');
this.endTransition = this.routlet.transition(); this.endTransition = this.routlet.transition();
// if we have no transition-duration set immediately end the transition let duration;
const duration = window if (this.element) {
.getComputedStyle(this.element) // if we have no transition-duration set immediately end the transition
.getPropertyValue('transition-duration'); duration = window.getComputedStyle(this.element).getPropertyValue('transition-duration');
} else {
duration = 0;
}
if (parseFloat(duration) === 0) { if (parseFloat(duration) === 0) {
this.endTransition(); this.endTransition();
} }