Skip to content

transition.data not kept across transition retry #325

Open
@Techn1x

Description

@Techn1x

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions