ionic-framework: bug: side menu throwing asserts
Bug Report
Ionic version:
[x] 4.x
Current behavior: Web preview enters debug mode after trying to access a page from the side menu
Expected behavior: Not enter debug mode. I’m not really sure if that’s intended or not.
Steps to reproduce: Trying to access a page through the side menu causes the application to enter debug mode. This happens only on the first time. It just happened on web preview, but didn’t test on native run. The debug apparentely points to a file inside node modules. The path is as follows:
node_modules/@ionic/core/dist/esm-es5/chunk-c90aaa66.js
and the line indicated is line 40
var assert = function (actual, reason) {
if (!actual) {
var message = 'ASSERT: ' + reason;
console.error(message);
debugger; // tslint:disable-line
throw new Error(message);
}
It also throws this error during debug: ASSERT: _before() should be called while animating
And this one after debug: Unhandled Promise rejection: ASSERT: _before() should be called while animating ; Zone: <root> ; Task: Promise.then ; Value: Error: ASSERT: _before() should be called while animating
Related code:
var assert = function (actual, reason) {
if (!actual) {
var message = 'ASSERT: ' + reason;
console.error(message);
debugger; // tslint:disable-line
throw new Error(message);
}
Other information:
Ionic info:
Ionic:
Ionic CLI : 5.4.4 (/home/rodrigo/.nvm/versions/node/v10.15.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.7.4
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 14 other plugins)
Utility:
cordova-res : 0.6.0 (update available: 0.8.0)
native-run : 0.2.8 (update available: 0.2.9)
System:
Android SDK Tools : 26.1.1 (/home/rodrigo/Android/Sdk)
NodeJS : v10.15.3 (/home/rodrigo/.nvm/versions/node/v10.15.3/bin/node)
npm : 6.11.3
OS : Linux 4.15
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 20 (4 by maintainers)
@digaus
by removing
ion-menu-togglethat wrap the logout button in html, it solved the problem, Thanks~ 😄*I didn’t add MenuGuard into the routing.
could this bug be prioritized higher ? it’s blocking the production ready application.
I am experiencing the same issue that happens with gesture and the button. I have a login page with the menu disabled using the MenuController. When I remove the line that disables the menu on that page, everything works as expected. I would guess it has something to do with the menu being enabled/disabled. Hope this helps.
I see exactly the same error popup every time i debug my app… This is on an actual phone not web or emulator
This still happens in Ionic 5.6 and now it has a “debugger” line on this code:
const assert = (actual, reason) => { if (!actual) { const message = 'ASSERT: ' + reason; console.error(message); debugger; // tslint:disable-line throw new Error(message); } };Ionic:
Ionic CLI : 6.12.4 (C:\Work\Tools\nvm\v14.0.0\node_modules@ionic\cli) Ionic Framework : @ionic/angular 5.6.0 @angular-devkit/build-angular : 0.1101.4 @angular-devkit/schematics : 11.2.3 @angular/cli : 11.1.4 @ionic/angular-toolkit : 3.1.0
Capacitor:
Capacitor CLI : 2.4.7 @capacitor/core : 2.4.7
My version is ionic 4.7.1 and also have that error when clicking logout from dashboard and the page return back to login view where the menu will get disabled, I put the menu disable code in the canActivate guard already but the problem still the same.
Below is the gif attachment to show what happen:
This is my canActivate code:
I don’t know if they happen on release builds, but when i deploy with ‘ionic cordova run android’ or if I use the debugger in VSCode, the exception happens every time I use a side menu item.