ionic-framework: Browser back button with @IonicPage pages throws TypeError: e.done is not a function

Ionic version: (check one with “x”) [ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [x] 3.x - 3.6.0

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: If we have 2 pages using @IonicPage annotation for deep linking, we navigate from Page 1 to Page 2 and click the browser back button, it throws an error.

Error: Uncaught (in promise): TypeError: e.done is not a function
TypeError: e.done is not a function
    at e._fireError (http://localhost:8101/build/vendor.js:1:280416)
    at e._failed (http://localhost:8101/build/vendor.js:1:280301)
    at http://localhost:8101/build/vendor.js:1:281125
...

EDIT: it also happens with the Android device back button.

Expected behavior: Navigating back and forth with browser buttons work without error, same as what we would have by using the app buttons (e.g. header bar back button).

Steps to reproduce:

  • Online demo: open dev tool, click the button to navigate and click browser back button. See the error in the console. In dev mode, it is also freezing the screen since errors are strongly reported.
  • Demo app sources on github, you can check the code, run locally and check the commit for steps.
  • Approximate steps (details in the source commit):
    • Generate a project with Ionic CLI with blank template
    • Generate a new page (ionic generate page page1)
    • Edit the home page to use @IonicPage annotation, add the corresponding module and remove references from AppModule
    • Add a simple navigation directive somewhere in the home page: <button ion-button navPush="Page1Page">Go to page 1</button>
  • I couldn’t make a working plunker with the new deeplink config (annotation and no direct references). My attempt

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages:

    @ionic/cli-plugin-ionic-angular : 1.4.0 (C:\nw\proto\ion-test-simple-nav\node_modules\@ionic\cli-plugin-ionic-angular)
    @ionic/cli-utils                : 1.6.0 (C:\nw\proto\ion-test-simple-nav\node_modules\@ionic\cli-utils)
    ionic (Ionic CLI)               : 3.6.0 (C:\nw\proto\ion-test-simple-nav\node_modules\ionic)

local packages:

    @ionic/app-scripts : 2.1.3
    Ionic Framework    : ionic-angular 3.6.0

System:

    Node : v8.2.1
    OS   : Windows 10
    npm  : 5.3.0 

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 46
  • Comments: 38 (7 by maintainers)

Most upvoted comments

Guys, please click 👍 on the original post to add weight to this issue instead of answering +1 😃 (some did, other not)

Root cause of this issue was attempting to call done callback before checking if it exists (see code). The PR which resolves this issue also provides better type support for the function callback so that type checking can detect potential issues.

@vhb56 - the PR that fixes this has been merged, but we are not ready to do a release yet. We are trying to get a few more fixes in.

Is anyone from Ionic going to resolve this issue? It was introduced 3 weeks ago due to poor code testing and a PR was proposed over a week ago and still no one has responded.

Is anyone from the community aware of an easy way to maintain your own Ionic repo? The design of the repo makes it impossible to simply link to a different github fork within the npm package.json. I’m having to compile my changes and copy them locally before each build, but this process breaks when trying to run my automated build/deploy scripts.

Looks like this was fixed in 3.6.1 for me too. Thanks!

@kensodemann - Any idea on timeline for this release? I’m trying to determine if I should roll back to 3.5.3 or wait for the fix.

Getting similar error on browser back btn click, shows error window, doesn’t break my app after closing error window!

Error: Uncaught (in promise): TypeError: ti.done is not a function TypeError: ti.done is not a function at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:44066:16) at NavControllerBase._failed (http://localhost:8100/build/vendor.js:44057:14) at http://localhost:8100/build/vendor.js:44112:59 at t.invoke (http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke (http://localhost:8100/build/vendor.js:4770:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:9223) at r.run (http://localhost:8100/build/polyfills.js:3:4452) at http://localhost:8100/build/polyfills.js:3:14076 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967) at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4761:37) at c (http://localhost:8100/build/polyfills.js:3:13535) at http://localhost:8100/build/polyfills.js:3:14107 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967) at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4761:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888) at r.runTask (http://localhost:8100/build/polyfills.js:3:5143) at o (http://localhost:8100/build/polyfills.js:3:2203) at <anonymous>

PLZ help guys, I tried “npm update -g cordova ionic” and when I do ionic -v it says I have 3.18.0 but in the browser I still have the same issue. Chrome browser console: Ionic … it says I have version 3.6.0

How do I correctly update???

I’v had the same problem in my simple project - after nightly build everything works perfect 😃 thank you very much!

With the same project source code, down grade packages ionic-angular to 3.5.3, and ionic to 3.6.0 seems to get browser back button working again (modify the package.json at the project root, and run npm install at the project root). Tested on a simple project and it worked for me, which may serve as a workaround till it’s fixed if you don’t mind regression and if it does not break other things.

Same error here guys:

Runtime Error

Uncaught (in promise): TypeError: ti.done is not a function TypeError: ti.done is not a function at
NavControllerBase._fireError (http://localhost:8100/build/vendor.js:47902:16) at
NavControllerBase._failed (http://localhost:8100/build/vendor.js:47893:14) at
http://localhost:8100/build/vendor.js:47948:59 at t.invoke (http://localhost:8100/build/polyfills.js:3:9283) at
Object.onInvoke (http://localhost:8100/build/vendor.js:4657:37) at t.invoke
(http://localhost:8100/build/polyfills.js:3:9223) at r.run (http://localhost:8100/build/polyfills.js:3:4452) at
http://localhost:8100/build/polyfills.js:3:14076 at t.invokeTask
(http://localhost:8100/build/polyfills.js:3:9967) at Object.onInvokeTask
(http://localhost:8100/build/vendor.js:4648:37) 

Stack

TypeError: ti.done is not a function
    at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:47902:16)
    at NavControllerBase._failed (http://localhost:8100/build/vendor.js:47893:14)
    at http://localhost:8100/build/vendor.js:47948:59
    at t.invoke (http://localhost:8100/build/polyfills.js:3:9283)
    at Object.onInvoke (http://localhost:8100/build/vendor.js:4657:37)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:9223)
    at r.run (http://localhost:8100/build/polyfills.js:3:4452)
    at http://localhost:8100/build/polyfills.js:3:14076
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4648:37)
    at c (http://localhost:8100/build/polyfills.js:3:13535)
    at http://localhost:8100/build/polyfills.js:3:14107
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4648:37)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888)
    at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)
    at o (http://localhost:8100/build/polyfills.js:3:2203)
    at <anonymous>

Environment

Ionic Framework: ^3.6.0
Ionic App Scripts: 2.1.3
Angular Core: 4.1.3
Angular Compiler CLI: 4.1.3
Node: 6.11.0
OS Platform: Linux 4.10
Navigator Platform: Linux x86_64
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36