* Replace a route by a index. * Note that this moves the index to the position to where the new route in the * stack is at.
(state, index, route)
| 151 | * stack is at. |
| 152 | */ |
| 153 | replaceAtIndex(state, index, route) { |
| 154 | invariant( |
| 155 | !!state.routes[index], |
| 156 | 'invalid index %s for replacing route %s', |
| 157 | index, |
| 158 | route.key |
| 159 | ); |
| 160 | |
| 161 | if (state.routes[index] === route && index === state.index) { |
| 162 | return state; |
| 163 | } |
| 164 | |
| 165 | const routes = state.routes.slice(); |
| 166 | routes[index] = route; |
| 167 | |
| 168 | return { |
| 169 | ...state, |
| 170 | index, |
| 171 | routes, |
| 172 | }; |
| 173 | }, |
| 174 | |
| 175 | /** |
| 176 | * Resets all routes. |
nothing calls this directly
no test coverage detected
searching dependent graphs…