-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Bug Report
Ionic version:
[x] 4.x
Current behavior:
When I swipe to open my side menu immediately after the app loaded, the app freezes. When I first tap the menu toggle button and then swipe, everything is fine.
Expected behavior:
App doesn't freeze.
Steps to reproduce:
I was able to reproduce this in Chrome and sometimes I got to see an error (see stacktrace below). I'm even able to get the preview to freeze on the Ionic docs when I swipe just before the app's first view is loaded: https://ionicframework.com/docs/api/menu
Related code:
The stacktrace below led me to this file: core/src/components/menu/menu.tsx
of this repo.
The error comes from the loadAnimation
function where this.menuInnerEl
is undefined at that time:
const width = this.menuInnerEl!.offsetWidth;
Other information:
Stacktrace:
zone.js:682 Unhandled Promise rejection: Cannot read property 'offsetWidth' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'offsetWidth' of undefined
at t.<anonymous> (n5wnzrch.entry.js:1)
at step (tslib.js:97)
at Object.next (tslib.js:78)
at tslib.js:71
at new ZoneAwarePromise (zone.js:910)
at Module.__awaiter (tslib.js:67)
at t.loadAnimation (n5wnzrch.entry.js:1)
at t.onWillStart (n5wnzrch.entry.js:1)
at onWillStart (n5wnzrch.entry.js:1)
at m (chunk-f56eaea8.js:1) TypeError: Cannot read property 'offsetWidth' of undefined
at t.<anonymous> (http://localhost:8100/70.js:44:4283)
at step (http://localhost:8100/80.js:158:21)
at Object.next (http://localhost:8100/80.js:139:51)
at http://localhost:8100/80.js:132:69
at new ZoneAwarePromise (http://localhost:8100/polyfills.js:3268:29)
at Module.__awaiter (http://localhost:8100/80.js:128:10)
at t.loadAnimation (http://localhost:8100/70.js:44:4107)
at t.onWillStart (http://localhost:8100/70.js:44:5351)
at onWillStart (http://localhost:8100/70.js:44:2193)
at m (http://localhost:8100/common.js:84:6209)
Ionic info:
ionic (Ionic CLI) : 4.10.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.2.0
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.5.0