emberjs / emberjs/router.js

Notification when aborted -> retried transition completes

Open
#260 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

For regular transitions, using the `then` method on the returned `Transition` works well. When the transition is completed then callback is called.

With aborted + retried transitions it's trickier. Since `retry` creates a new transition (code below), it isn't possible to get notified when it resolves.

1. Is this by design?
2. If not, would it be possible to improve this?

Copying over the transition would work, but may break things (I don't know). Another option would be to introduce another method, something like `retryableThen()` on `Promise`, whose underlying promise would get copied over to retried transitions.

What are your thoughts? (cc: @asakusuma @chadhietala)

```js
retry() {
this.abort();
let newTransition = this.router.transitionByIntent(this.intent as OpaqueIntent, false);

// [...] shortened for clarity
return newTransition;
}
```
Source: https://github.com/tildeio/router.js/blob/c82c0ca1b7/lib/router/transition.ts#L273

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/router/transition.ts at retry(), then trace router.transitionByIntent and the existing Transition.then behavior described in the issue. Determine how an aborted transition's retry could preserve completion notification semantics, and document the intended API and completion behavior before attempting an implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.