Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using back button does not re-trigger all my routes #50

Open
newtonianb opened this issue Mar 7, 2015 · 0 comments
Open

using back button does not re-trigger all my routes #50

newtonianb opened this issue Mar 7, 2015 · 0 comments

Comments

@newtonianb
Copy link

Situation: Loading the page from the URL triggers all my routes and subroutes but accessing that URL after pressing the back or forward button only triggers the last subroute.

Problem
Let's say I access http://host/path1/path2/path3 from within he App I click on a link which brings me to http://host/otherpath. When I press the back button it brings me back to http://host/path1/path2/path3 in the URL but only my ModuleThree.Router gets hit. I want all of them to get hit again, how can I do this?

  1. user loads url http://host/path1/path2/path3
inside one
inside two
inside three
  1. user clicks on link that goes to http://otherpath
  2. user presses back button
inside three

My problem is on step 3, I'm expecting all the subroutes to re-trigger for my app to function correctly but only the last sub-route is triggered.

Example: Below I setup my subrouters so when accessing
http://host/path1/path2/path3 I have 3 matches triggered total

/path1/*subroute handled by ModuleOne.Router (initialized by appInitiliazer)
/path2/*subroute handled by ModuleTwo.Router (initialized by ModuleOne.Router)
/path3/*subroute handled by ModuleThree.Router (initialized by ModuleTwo.Router)

  ## ROUTER
  class ModuleOne.Router extends App.Router
    routes:
         "path1/*subroute" : "pathOne"
    pathOne: (hash) ->
            console.log 'inside one'

      ## this gets triggered on URL enter if /path1 is in URL
      new App.ModuleTwo.Router("path1")

    new ModuleOne.Router

## -------------------------------------------------------

  ## ROUTER
  class ModuleTwo.Router extends App.SubRouter
    routes:
      "path2/*subroute" : "pathTwo"
    pathTwo: ->
      console.log 'inside two'
      new App.ModuleThree.Router("path1/path2")
## -------------------------------------------------------
  ## ROUTER
  class ModuleThree.Router extends App.SubRouter
    routes:
      "path3/*subroute" : "pathThree"  
    pathThree: ->
      console.log 'inside three'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant