Description
Hi! I'm trying to make use of transition.data
to keep a count of transition retries. Something like the following;
// application route
@action
error(error, transition) {
if (error.retryable) {
const transitionData = transition.data || {}
const { retryCount = 0 } = transitionData
if (retryCount < 3) {
transition.data = { ...transitionData, retryCount: retryCount + 1 }
transition.retry()
} else {
// some other remedy
}
}
}
Unfortunately, it seems what I set in transition.data
is forgotten when the transition is retried - if that retried transition fails and re-enters the error hook, retryCount is gone. The Ember docs specifically mention that this should work https://api.emberjs.com/ember/3.27/classes/Transition/properties/data?anchor=data
Properties set on data will be copied to new transitions generated by calling retry on this transition
As a workaround, I have found that I can set transition.intent.data
and it remembers it across the retry. Though I am not sure of the implications of doing that (if any)
It might be related to #77 though that issue seems very old!
Activity