tidy up code

This commit is contained in:
contributor 2025-11-23 00:08:57 +02:00
parent 2c447a4293
commit 1ac241ad1b

View File

@ -6,7 +6,7 @@ import attributes from "../../services/attributes";
import FNote from "../../entities/fnote"; import FNote from "../../entities/fnote";
import toast from "../../services/toast"; import toast from "../../services/toast";
import froca from "../../services/froca"; import froca from "../../services/froca";
import { useContext, useEffect, useMemo, useState } from "preact/hooks"; import { useContext, useEffect, useState } from "preact/hooks";
import { ParentComponent } from "../react/react_utils"; import { ParentComponent } from "../react/react_utils";
import { useTriliumEvent } from "../react/hooks"; import { useTriliumEvent } from "../react/hooks";
import appContext from "../../components/app_context"; import appContext from "../../components/app_context";
@ -75,7 +75,7 @@ export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }
useEffect(() => { useEffect(() => {
async function autoExecute() { async function autoExecute() {
if (!note || note?.type !== "search" || !note?.hasLabel("autoExecuteSearch")) { if (!note || note.type !== "search" || !note.hasLabel("autoExecuteSearch")) {
executionState.save(""); executionState.save("");
return; return;
} }
@ -182,10 +182,10 @@ export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }
} }
const executionState = function() { const executionState = function() {
let LAST_AUTO_EXECUTED_SEARCH_NOTE_ID = ""; let lastAutoExecutedSearchNoteId = "";
return { return {
load: () => LAST_AUTO_EXECUTED_SEARCH_NOTE_ID, load: () => lastAutoExecutedSearchNoteId,
save: (noteId: string) => LAST_AUTO_EXECUTED_SEARCH_NOTE_ID = noteId, save: (noteId: string) => lastAutoExecutedSearchNoteId = noteId,
}; };
}(); }();