ionic-framework: Runtime Error Uncaught (in promise): removeView was not found - fast modal dismissing (lazy loaded)
Ionic version: (check one with “x”) [ ] 1.x (For Ionic 1.x issues, please use https://github.com/driftyco/ionic-v1) [ ] 2.x [x ] 3.x
I’m submitting a … (check one with “x”) [x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior: So I have a simple modal that is created from a page using lazy-loading:
showRegionSearch() {
let p = this.modalCtrl.create('RegionSearch');
p.present();
}
I am testing my application through “ionic serve”. When my modal is visible I want to just dismiss it by pressing ESCAPE on my keyboard. Everything is working fine when I press ESC button once, but when I fast double click ESCAPE I get this error:
Error: Uncaught (in promise): removeView was not found
at d (http://localhost:8100/build/polyfills.js:3:3991)
at l (http://localhost:8100/build/polyfills.js:3:3244)
at l (http://localhost:8100/build/polyfills.js:3:2930)
at http://localhost:8100/build/polyfills.js:3:3758
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:12256)
at Object.onInvokeTask (http://localhost:8100/build/main.js:4468:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:12177)
at n.runTask (http://localhost:8100/build/polyfills.js:3:7153)
at a (http://localhost:8100/build/polyfills.js:3:2312)
at <anonymous>
Expected behavior: Dismiss lazy-loaded modal without error no matter how many times and how fast I’ve pressed ESCAPE button.
Steps to reproduce: Just create “lazy” ionic app with “lazy” modal from a page and fast double click ESCAPE button to dismiss the modal.
Related code:
let p = this.modalCtrl.create('SomePage');
p.present();
Other information: My app is fresh and simple.
Ionic info: (run ionic info
from a terminal/cmd prompt and paste output below):
6.5.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.1
Xcode version: Not installed
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 14
- Comments: 24 (5 by maintainers)
How to hotfix?
@kleeb @napcat @DatBluBat
onWillDismiss
handler registrations to use the methodonDidDismiss
instead.dismiss()
call in your code and replace it bydismiss().catch(() => {});
. Since there is only this annoying exception being thrown to a potential exception handler, I don’t see any problem in a catch-all-ignore attempt here. Please correct me if I’m wrong.@JorgeGRC Please try that and tell me if it helps. I remember that I had a similar problem with modals and lazy loading. It also led to the
removeView was not found
error, but it haven’t had any in common with the issue above. The root cause of that issue was, that the remote view wasn’t found because the module wasn’t loaded properly at the time of presenting. The issue described here is about dismissing an already dismissed view.I remember that I was able to solve the lazy-loading and modal presenting issue just by fixing my imports, declarations and entryComponents of the related module bundle configuration. This is, for example, how a modal module config looks like on my side:
I call the modal lazy loaded like that:
You might be missing the
entryComponents
or properforChild
call.Also make sure you’ve added the
@IonicPage
annotation:I’ve the same issue here
Incredible, this bug is still there from nearly one year.
We can not resolve this issue from client side, this issue must be resolved in ionic framework!
@kyr0 version does work for manual dismissing a modal page but not for double ESCAPE press.
right?
I’m only put
return false
on last line of callback like:I have a same problem… loader.dismiss(); is double, please check…
I get this bug when I use the IonicPage directive and attempt to go back to previous pages.
Same issue here, reported many times by sentry error reporting in my live app 😦
Still occuring even on the nightly build
I updated to the latest version 3.3.0 and this is also happening in my app.
I have reproduced the bug and I found out this bug also effects:
this bug can be fixed in many ways:
this.viewCtrl.dissmis(...)
in each component by simply having an empty catchaboutToLeave
@brandyscarney I can open a PR for this bug, should I open 1 PR per component or one PR for all component.