diff --git a/apps/client/src/services/note_autocomplete.ts b/apps/client/src/services/note_autocomplete.ts index a95f4083e..1138b191e 100644 --- a/apps/client/src/services/note_autocomplete.ts +++ b/apps/client/src/services/note_autocomplete.ts @@ -39,7 +39,7 @@ export interface Suggestion { } export interface Options { - container?: HTMLElement; + container?: HTMLElement | null; fastSearch?: boolean; allowCreatingNotes?: boolean; allowJumpToSearchNotes?: boolean; diff --git a/apps/client/src/widgets/dialogs/export.tsx b/apps/client/src/widgets/dialogs/export.tsx index bb71979fb..3543e3b35 100644 --- a/apps/client/src/widgets/dialogs/export.tsx +++ b/apps/client/src/widgets/dialogs/export.tsx @@ -21,7 +21,7 @@ interface ExportDialogProps { function ExportDialogComponent() { const [ opts, setOpts ] = useState(); - const [ exportType, setExportType ] = useState(opts?.defaultType ?? "subtree"); + const [ exportType, setExportType ] = useState(opts?.defaultType ?? "subtree"); const [ subtreeFormat, setSubtreeFormat ] = useState("html"); const [ singleFormat, setSingleFormat ] = useState("html"); const [ opmlVersion, setOpmlVersion ] = useState("2.0"); diff --git a/apps/client/src/widgets/dialogs/jump_to_note.tsx b/apps/client/src/widgets/dialogs/jump_to_note.tsx index 2883055a1..6f3e8457f 100644 --- a/apps/client/src/widgets/dialogs/jump_to_note.tsx +++ b/apps/client/src/widgets/dialogs/jump_to_note.tsx @@ -52,7 +52,11 @@ function JumpToNoteDialogComponent() { setIsCommandMode(text.startsWith(">")); }, [ text ]); - async function onItemSelected(suggestion: Suggestion) { + async function onItemSelected(suggestion?: Suggestion | null) { + if (!suggestion) { + return; + } + setShown(false); if (suggestion.notePath) { appContext.tabManager.getActiveContext()?.setNote(suggestion.notePath); diff --git a/apps/client/src/widgets/dialogs/recent_changes.tsx b/apps/client/src/widgets/dialogs/recent_changes.tsx index acd363787..0bf3b08fe 100644 --- a/apps/client/src/widgets/dialogs/recent_changes.tsx +++ b/apps/client/src/widgets/dialogs/recent_changes.tsx @@ -8,7 +8,7 @@ import Button from "../react/Button"; import Modal from "../react/Modal"; import ReactBasicWidget from "../react/ReactBasicWidget"; import hoisted_note from "../../services/hoisted_note"; -import type { RecentChangesRow } from "@triliumnext/commons"; +import type { RecentChangeRow } from "@triliumnext/commons"; import froca from "../../services/froca"; import { formatDateTime } from "../../utils/formatters"; import link from "../../services/link"; @@ -18,7 +18,7 @@ import useTriliumEvent from "../react/hooks"; function RecentChangesDialogComponent() { const [ ancestorNoteId, setAncestorNoteId ] = useState(); - const [ groupedByDate, setGroupedByDate ] = useState>(); + const [ groupedByDate, setGroupedByDate ] = useState>(); const [ needsRefresh, setNeedsRefresh ] = useState(false); const [ shown, setShown ] = useState(false); @@ -34,7 +34,7 @@ function RecentChangesDialogComponent() { setNeedsRefresh(false); } - server.get(`recent-changes/${ancestorNoteId}`) + server.get(`recent-changes/${ancestorNoteId}`) .then(async (recentChanges) => { // preload all notes into cache await froca.getNotes( @@ -78,7 +78,7 @@ function RecentChangesDialogComponent() { ) } -function RecentChangesTimeline({ groupedByDate, setShown }: { groupedByDate: Map, setShown: Dispatch> }) { +function RecentChangesTimeline({ groupedByDate, setShown }: { groupedByDate: Map, setShown: Dispatch> }) { return ( <> { Array.from(groupedByDate.entries()).map(([dateDay, dayChanges]) => { @@ -129,7 +129,7 @@ function NoteLink({ notePath, title }: { notePath: string, title: string }) { ); } -function DeletedNoteLink({ change, setShown }: { change: RecentChangesRow, setShown: Dispatch> }) { +function DeletedNoteLink({ change, setShown }: { change: RecentChangeRow, setShown: Dispatch> }) { return ( <> {change.current_title} @@ -165,8 +165,8 @@ export default class RecentChangesDialog extends ReactBasicWidget { } -function groupByDate(rows: RecentChangesRow[]) { - const groupedByDate = new Map(); +function groupByDate(rows: RecentChangeRow[]) { + const groupedByDate = new Map(); for (const row of rows) { const dateDay = row.date.substr(0, 10); diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsx index 93b558a05..71078e21b 100644 --- a/apps/client/src/widgets/react/Dropdown.tsx +++ b/apps/client/src/widgets/react/Dropdown.tsx @@ -9,8 +9,8 @@ interface DropdownProps { } export default function Dropdown({ className, isStatic, children }: DropdownProps) { - const dropdownRef = useRef(); - const triggerRef = useRef(); + const dropdownRef = useRef(null); + const triggerRef = useRef(null); if (triggerRef?.current) { useEffect(() => { diff --git a/apps/client/src/widgets/react/NoteAutocomplete.tsx b/apps/client/src/widgets/react/NoteAutocomplete.tsx index 580c00002..49656bf71 100644 --- a/apps/client/src/widgets/react/NoteAutocomplete.tsx +++ b/apps/client/src/widgets/react/NoteAutocomplete.tsx @@ -9,7 +9,7 @@ interface NoteAutocompleteProps { inputRef?: RefObject; text?: string; placeholder?: string; - container?: RefObject; + container?: RefObject; containerStyle?: CSSProperties; opts?: Omit; onChange?: (suggestion: Suggestion | null) => void;