fix(react/dialogs): some type errors

This commit is contained in:
Elian Doran
2025-08-06 18:38:52 +03:00
parent edd18b53d0
commit bde270b73f
12 changed files with 75 additions and 28 deletions

View File

@@ -17,15 +17,19 @@ import toast from "../../services/toast";
import NoteList from "../react/NoteList";
interface CloneToDialogProps {
clonedNoteIds: string[];
clonedNoteIds?: string[];
}
function CloneToDialogComponent({ clonedNoteIds }: CloneToDialogProps) {
const [ prefix, setPrefix ] = useState("");
const [ suggestion, setSuggestion ] = useState<Suggestion>(null);
const [ suggestion, setSuggestion ] = useState<Suggestion | null>(null);
const autoCompleteRef = useRef<HTMLInputElement>(null);
function onSubmit() {
if (!clonedNoteIds) {
return;
}
const notePath = suggestion?.notePath;
if (!notePath) {
logError(t("clone_to.no_path_to_clone_to"));
@@ -64,7 +68,7 @@ function CloneToDialogComponent({ clonedNoteIds }: CloneToDialogProps) {
export default class CloneToDialog extends ReactBasicWidget {
private props: CloneToDialogProps;
private props: CloneToDialogProps = {};
get component() {
return <CloneToDialogComponent {...this.props} />;
@@ -75,7 +79,7 @@ export default class CloneToDialog extends ReactBasicWidget {
noteIds = [appContext.tabManager.getActiveContextNoteId() ?? ""];
}
const clonedNoteIds = [];
const clonedNoteIds: string[] = [];
for (const noteId of noteIds) {
if (!clonedNoteIds.includes(noteId)) {