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

Not an Issue (really) #3

Open
exbm opened this issue Dec 28, 2012 · 3 comments
Open

Not an Issue (really) #3

exbm opened this issue Dec 28, 2012 · 3 comments

Comments

@exbm
Copy link

exbm commented Dec 28, 2012

I love finch.js! but this new feature splats is defineatly a problem I keep bumping into when trying to code routes. Splats would make my life sooo much easier!!! also what do you think about this problem

lets say i have a route:

/:article

now when the article loads it loads a module gallery and an image is clicked i want the route to to be

/:article/:image

The problem is the /:article/:image route won't exist until you load the article which loads the module that creates that route

so if you give someone a link /:aritcle/:image finch will throw it away unless you go to the homepage where the /:aritcle route is created

then the /:article/:image route is created

what if when you give finch the url /:aritcle:/image it goes hey that route doesn't exist but /:article does exist lets setup that oOo there is /:aritcle/:image !

@stoodder
Copy link
Owner

Hey! Thanks for the feedback!

Typically when implementing routes in javascript, they would all be defined in a single script file on page load. I had never thought about essentially lazy loading routes. But now that you mention it, I think it would definitely be useful and we'll add it. My thought is that we would have a setting for defining how someone would handle routes that don't exist yet. The current way (go back to the previous route) or attempt to load up the route hierarchy and stop at the last valid node.

Also, I'm currently working on finishing up test and documentation for another librar,y Falcon js (MVC like Backbone but geared towards using Knockout), and after I'm finished with that I'll give Finch more attention and finish up the splats/pushState pieces.

Thanks again for the feedback! much appreciated.

@exbm
Copy link
Author

exbm commented Jan 2, 2013

Right now, you have you search the route tree, find the current routepath in the tree and send that back then you run the step function on each route in the routepath. what if you ran the step function each time you found a valid route in the routetree

parent/child/sub-child

findpath (parent) ->
--step()
findpath (child) ->
--step()
findpath(sub-child) ->
--step()
findpath(noexist) ->
return

then the parent path has a chance to execute and create it's child routes in the routetree before they are operated on. This would also mean the findpath function would have to wait for the step function to return it's childCallBack() for async.. What do you think about that? I might try and code something like that but my kungfu is not as good as yours and I don't code in coffeeScript

right now i got around it by using observe instead of child routes

@netaisllc
Copy link

The use case for having a dynamically loaded set of routes isn't all that unusual.

Consider you are a user with credential set "A". It would be expected that only routes related to that credential set would be loaded.

Now, during the session, your credentials are upgraded to set "B"; it would be reasonable to expect that an additional set of routes would be become available.

Yes. you could simply load all possible routes at the outset, but the point is, you shouldn't have to do that unless it fits your needs.

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

3 participants