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
1 changed files with 8 additions and 4 deletions

View File

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