#338 - Fixed, + fixed some other noUncheckedIndexedAccess

This commit is contained in:
Simon Cambier
2024-01-06 10:53:11 +01:00
parent 79e82fcc27
commit 94b34c2a8f

View File

@@ -116,7 +116,7 @@
historySearchIndex = 0 historySearchIndex = 0
} }
searchQuery = history[historySearchIndex] searchQuery = history[historySearchIndex]
refInput?.setInputValue(searchQuery) refInput?.setInputValue(searchQuery ?? '')
} }
async function nextSearchHistory() { async function nextSearchHistory() {
@@ -125,7 +125,7 @@
historySearchIndex = history.length ? history.length - 1 : 0 historySearchIndex = history.length ? history.length - 1 : 0
} }
searchQuery = history[historySearchIndex] searchQuery = history[historySearchIndex]
refInput?.setInputValue(searchQuery) refInput?.setInputValue(searchQuery ?? '')
} }
let cancelableQuery: CancelablePromise<ResultNote[]> | null = null let cancelableQuery: CancelablePromise<ResultNote[]> | null = null
@@ -186,7 +186,8 @@
function openSearchResult(note: ResultNote, newPane = false) { function openSearchResult(note: ResultNote, newPane = false) {
saveCurrentQuery() saveCurrentQuery()
openNote(note, note.matches[0].offset, newPane) const offset = note.matches?.[0]?.offset ?? 0
openNote(note, offset, newPane)
} }
async function onClickCreateNote(_e: MouseEvent) { async function onClickCreateNote(_e: MouseEvent) {