Invariant throws false-positive for IndexRoutes
jonathanglasmeyer opened this issue · 4 comments
jonathanglasmeyer commented
Version
'react-router-native': '2.0.0-alpha.4',
'react-router': '3.0.0-alpha.3',
'history': '3.2.1',
'react-native': '0.32',
The invariant at ReducerUtils.js
:333 throws a false positive for IndexRoutes (i think).
It wants a reducer and a transition for IndexRoutes, which is not the indended behaviour (i think ;)).
I fixed it like so:
invariant(
+ key && path && type && (reducer || type === 'index') && (transition || type === ROUTE || type === 'index'),
- key && path && type && reducer && (transition || type === ROUTE),
'Incompatible route definition. Make sure peer dependecy requirements are met. If you are ' +
'using plain objects to define your routes, in addition to the options required by React ' +
'Router, each route has to specify the following: `routeType`, `reducer`, `transition`.'
);
Is my reasoning correct?
MoOx commented
@jmurzy I am facing the same error. Not sure why reducer is undefined, it's confusing as this warning looks like an internal warning. Looks like @jonathanewerner fix is working for me.
aforty commented
Same problem, can't seem to use IndexRoute
at all due to this.
jmurzy commented
Sorry, I just returned from vacation. Will release @jonathanewerner's patch in a release shortly.
Deleted user commented
I don't see that this was ever applied to release. Is it in a specific tag or branch?