use module level var instead of sessionStorage

This commit is contained in:
contributor 2025-11-22 23:53:50 +02:00
parent 6c1886c5ca
commit 2c447a4293

View File

@ -73,14 +73,6 @@ export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }
} }
}); });
const executionState = useMemo(() => {
const AUTO_EXEC_KEY = "lastAutoExecutedSearchNote";
return {
load: () => sessionStorage.getItem(AUTO_EXEC_KEY),
save: (noteId: string) => sessionStorage.setItem(AUTO_EXEC_KEY, noteId),
};
}, []);
useEffect(() => { useEffect(() => {
async function autoExecute() { async function autoExecute() {
if (!note || note?.type !== "search" || !note?.hasLabel("autoExecuteSearch")) { if (!note || note?.type !== "search" || !note?.hasLabel("autoExecuteSearch")) {
@ -189,6 +181,14 @@ export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }
) )
} }
const executionState = function() {
let LAST_AUTO_EXECUTED_SEARCH_NOTE_ID = "";
return {
load: () => LAST_AUTO_EXECUTED_SEARCH_NOTE_ID,
save: (noteId: string) => LAST_AUTO_EXECUTED_SEARCH_NOTE_ID = noteId,
};
}();
function BulkActionsList({ note }: { note: FNote }) { function BulkActionsList({ note }: { note: FNote }) {
const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>(); const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>();