(nextState: RouterState, restoreFocus: boolean)
| 221 | } |
| 222 | |
| 223 | function commitState(nextState: RouterState, restoreFocus: boolean): void { |
| 224 | if (nextState === state) return; |
| 225 | state = nextState; |
| 226 | |
| 227 | pruneUnusedFocusSnapshots(focusSnapshotsByVisitId, state); |
| 228 | |
| 229 | if (restoreFocus) { |
| 230 | const currentEntry = state.entries[state.entries.length - 1]; |
| 231 | if (currentEntry) { |
| 232 | const snapshot = focusSnapshotsByVisitId.get(currentEntry.visitId); |
| 233 | if (snapshot) { |
| 234 | opts.restoreFocusSnapshot(snapshot); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | opts.requestRouteRender(); |
| 240 | } |
| 241 | |
| 242 | function coerceFirstRouteId(routes: readonly RouteDefinition<S>[]): string { |
| 243 | const first = routes[0]; |
no test coverage detected