Coder Social home page Coder Social logo

Comments (6)

christopherthielen avatar christopherthielen commented on April 25, 2024

I think this is not a bug.

I think the problem with is when you redirect to A.B.C, you're not merging the old parameter values ({organization_id}) with the new ones ({application_id}). When you try to activate sessions state, there is no organization_id, so the parent state doesn't validate.

The reason it works with a timeout is that $state.go inherits the current parameter values. The timeout allows the transition to complete, and the globals object to be updated with the
organization_id parameter value.

Try using { ...trans.params(), application_id } or Object.assign({}, trans.params(), { application_id })

One other potential problem with your approach is that I believe your resolves will be fetched multiple times; once for each new transition. To avoid this, redirect the transition to the child by returning a $state.target() instead of calling $state.go().

return stateService.target(sessions.state, {...trans.params(), application_id});

from core.

FGRibreau avatar FGRibreau commented on April 25, 2024

Hello @christopherthielen !

Arg, that was one of my initial hypothesis that onEnter was a callback called (too soon) when entering the state and not once the state was ready but since I could not find any other alternative I guessed that onEnter was only called when the current state was done initialized.

Indeed with both the param merging & the return it works!

This kind of information would profit to everyone in the documentation, I'm surely not the only one doing this ^^. Could you point me to where I should add this kind of information and start a PR for it?

from core.

FGRibreau avatar FGRibreau commented on April 25, 2024

@christopherthielen hum, in fact the return stateService... generates an error:

The transition has been superseded by a different transition

from core.

christopherthielen avatar christopherthielen commented on April 25, 2024

Could you point me to where I should add this kind of information and start a PR for it?

What we really need is a new page in the web site's "guides" section that details the lifecycle of a transition.

It's been on my list of things to do, but will have to wait for a bit longer.

hum, in fact the return stateService... generates an erro

Can you be more specific? If you're returning .target() it shouldn't print a superseded message. That message isn't necessarily an "error". It only means that while one transition was still in progress, a new transition was started. The original transition is cancelled and the new transition supersedes the original one.

from core.

FGRibreau avatar FGRibreau commented on April 25, 2024

What we really need is a new page in the web site's "guides" section that details the lifecycle of a transition.

That would be great yeah!

If you're returning .target() it shouldn't print a superseded message. That message isn't necessarily an "error". It only means that while one transition was still in progress, a new transition was started. The original transition is cancelled and the new transition supersedes the original one.

Sadly it's considered as an error (and I got an error from it with .message === "The transition has been superseded by a different transition") why not replace this type of information with something else than an error? I was personally misguided by the fact that it was an Error I though I did something wrong.

capture d ecran 2017-01-05 00 01 46

from core.

stale avatar stale commented on April 25, 2024

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues
may be reopened.

Thank you for your contributions.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.