( history: TabHistoryEntry[], historyIndex: number, tab: Tab )
| 69 | } |
| 70 | |
| 71 | function computeNewHistory( |
| 72 | history: TabHistoryEntry[], |
| 73 | historyIndex: number, |
| 74 | tab: Tab |
| 75 | ): { history: TabHistoryEntry[]; historyIndex: number } { |
| 76 | if (isNavigating) { |
| 77 | return { history, historyIndex } |
| 78 | } |
| 79 | if (history[historyIndex]?.tabId === tab.id) { |
| 80 | return { history, historyIndex } |
| 81 | } |
| 82 | const newHistory = [...history.slice(0, historyIndex + 1), toHistoryEntry(tab)] |
| 83 | return { history: newHistory, historyIndex: newHistory.length - 1 } |
| 84 | } |
| 85 | |
| 86 | function tryNavigateToHistory( |
| 87 | history: TabHistoryEntry[], |
no test coverage detected