emberjs / emberjs/ember.js

Transition retry failed with exception

Open
#17,743 1 comment 3 reactions 0 assignees View on GitHub
Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

Transition retry is failing with exception `Cannot read property 'applyToState' of undefined` on ember-source 3.7.3

```
vendor.js:253517 ember TypeError: Cannot read property 'applyToState' of undefined
at PrivateRouter.getTransitionByIntent (http://localhost:3000/ui/assets/vendor.js:64089:35)
at PrivateRouter.transitionByIntent (http://localhost:3000/ui/assets/vendor.js:64052:29)
at Transition.retry (http://localhost:3000/ui/assets/vendor.js:63215:45)
at Ember.RSVP.resolve.then.then (http://localhost:3000/ui/assets/vendor.js:238301:37)
at tryCatcher (http://localhost:3000/ui/assets/vendor.js:65044:21)
at invokeCallback (http://localhost:3000/ui/assets/vendor.js:65214:33)
at publish (http://localhost:3000/ui/assets/vendor.js:65200:9)
at _runloop.backburner.schedule (http://localhost:3000/ui/assets/vendor.js:60408:53)
at invokeWithOnError (http://localhost:3000/ui/assets/vendor.js:59062:28)
at Queue.flush (http://localhost:3000/ui/assets/vendor.js:58975:25)
at DeferredActionQueues.flush (http://localhost:3000/ui/assets/vendor.js:59127:31)
at Backburner._end (http://localhost:3000/ui/assets/vendor.js:59557:42)
at MutationObserver.Backburner._boundAutorunEnd (http://localhost:3000/ui/assets/vendor.js:59294:22)
```

On following line:

```
let newState = intent.applyToState(oldState, isIntermediate);
```

The `transition.intent` is undefined. I am getting to this situation as I am using `transition.abort`. then there is some timeout - confirmation modal is shown and if confirmed I am trying to retry original transition. I am using router service api event `routeWillChange`.

My current workaround is to abort only transitions with non undefined intent. But the intent is private undocumented property.

Btw: What I am trying to achieve is to have promise based confirmation dialog when leaving specific route or switching model. This is very difficult to achieve with new router service api without `willTransition` hook on route itself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.