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
Don't throw errors when links can't find a route #70
Comments
You don't actually need to render your route in order for links to find it. You just need to register it with the var Router = require('react-nested-router');
var routes = require('../app/routes');
Router.register(routes); |
Seems good. Cons Something I really don't like is having to do things differently for tests v. app code. If we instead just warn, then developers don't have to know anything extra to test their route handlers. Pros However, if we just warn, applications could have busted links due to typos and tracking those down could get difficult, throwing an error stops you in your tracks, ensuring your app works before you ship it. Additionally, not requiring a render is good so that you don't have to worry about everything your app is going to do with the initial handlers (like fetching user data, etc.) I'd say yes, lets expose |
Would the |
@phated Yes, it would. Basically @rpflorence If we had a use for a |
Yeah, before we went to just a component this testing scenario simply required pulling in your route config, no rendering required. Sent from my iPhone
|
I removed the |
|
👍 for |
The other potential benefit of Something like: Router.register Route
name: 'foobar'
handler: React.createComponent
render: ->
div {}, 'foobar' (note the space between register and Route) I prefer (and it seems like you guys do, too) an explicit routing table, but this functionality is present in many modern web systems. |
only somebody dealing with coffeescript pain daily would say something like this :P |
Ha! One man's pain is another man's pleasure 😎 I thought it was worth pointing out, but perhaps a newline would've been a better way to do that. |
I'm not so convinced we need this anymore. I haven't really seen any solid use cases. |
I'm testing a generic
And the component I'm testing:
The issue I'm running into right now is that the simulate click is not actually routing, even though debugging through the transitionTo call is getting invoked properly. The I demonstrate this example, because I feel that it is a fine example that you shouldn't need a full blown route table to test something trivial like this. |
Now that we have RouteStore.registerRoutes we can close this. |
👍 |
We should probably just warn here:
https://github.com/rpflorence/react-nested-router/blob/468bf3b20aa88413a03b3f94d518b3d70a437ffe/modules/helpers/makePath.js#L16-L20
Otherwise, you have to render a router before testing your handlers with something like:
The text was updated successfully, but these errors were encountered: