From dff654b6e51cd61f00f62aaeff9ca3a1c16cc41f Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Wed, 14 Jan 2026 08:07:22 +0000 Subject: [PATCH] Fixed: - Fixed mishandling of removing duplicated queue on processing - Dependency importing --- src/deps.ts | 4 ++++ src/modules/core/ReplicateResultProcessor.ts | 2 +- src/modules/coreObsidian/ModuleFileAccessObsidian.ts | 2 +- src/modules/coreObsidian/storageLib/StorageEventManager.ts | 4 ++-- src/modules/extras/ModuleReplicateTest.ts | 2 +- src/modules/features/SettingDialogue/LiveSyncSetting.ts | 2 +- test/harness/harness.ts | 2 +- test/suite/onlylocaldb.test.ts | 2 +- test/suite/sync.senario.basic.ts | 2 +- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/deps.ts b/src/deps.ts index 29e2a18..330c3df 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -28,6 +28,10 @@ export { request, getLanguage, ButtonComponent, + TextComponent, + ToggleComponent, + DropdownComponent, + ValueComponent, } from "obsidian"; export type { DataWriteOptions, diff --git a/src/modules/core/ReplicateResultProcessor.ts b/src/modules/core/ReplicateResultProcessor.ts index 1304195..fcb45d6 100644 --- a/src/modules/core/ReplicateResultProcessor.ts +++ b/src/modules/core/ReplicateResultProcessor.ts @@ -342,7 +342,7 @@ export class ReplicateResultProcessor { return; } finally { // Remove from processing queue - this._processingChanges = this._processingChanges.filter((e) => e === change); + this._processingChanges = this._processingChanges.filter((e) => e !== change); this.triggerTakeSnapshot(); } } diff --git a/src/modules/coreObsidian/ModuleFileAccessObsidian.ts b/src/modules/coreObsidian/ModuleFileAccessObsidian.ts index 4b08808..e7c617f 100644 --- a/src/modules/coreObsidian/ModuleFileAccessObsidian.ts +++ b/src/modules/coreObsidian/ModuleFileAccessObsidian.ts @@ -1,4 +1,4 @@ -import { TFile, TFolder, type ListedFiles } from "obsidian"; +import { TFile, TFolder, type ListedFiles } from "@/deps.ts"; import { SerializedFileAccess } from "./storageLib/SerializedFileAccess"; import { AbstractObsidianModule } from "../AbstractObsidianModule.ts"; import { LOG_LEVEL_INFO, LOG_LEVEL_VERBOSE } from "octagonal-wheels/common/logger"; diff --git a/src/modules/coreObsidian/storageLib/StorageEventManager.ts b/src/modules/coreObsidian/storageLib/StorageEventManager.ts index 08afa8d..d1dac58 100644 --- a/src/modules/coreObsidian/storageLib/StorageEventManager.ts +++ b/src/modules/coreObsidian/storageLib/StorageEventManager.ts @@ -497,7 +497,7 @@ export class StorageEventManagerObsidian extends StorageEventManager { if (fei.type == "CREATE" || fei.type == "CHANGED") { // 3.2. If true, set the queue, and wait for the waiting, or until timeout // (since is copied from previous waiting if exists to limit the maximum wait time) - console.warn(`Since:`, previous?.since); + // console.warn(`Since:`, previous?.since); const info = this._addWaiting(waitingKey, fei, previous?.since); waitPromise = info.canProceed.promise; } else if (fei.type == "DELETE") { @@ -531,7 +531,7 @@ export class StorageEventManagerObsidian extends StorageEventManager { "storage-event-manager-snapshot" ); if (snapShot && Array.isArray(snapShot) && snapShot.length > 0) { - console.warn(`Restoring snapshot: ${snapShot.length} items`); + // console.warn(`Restoring snapshot: ${snapShot.length} items`); Logger(`Restoring storage operation snapshot: ${snapShot.length} items`, LOG_LEVEL_VERBOSE); // Restore the snapshot // Note: Mark all items as skipBatchWait to prevent apply the off-line batch saving. diff --git a/src/modules/extras/ModuleReplicateTest.ts b/src/modules/extras/ModuleReplicateTest.ts index cb71def..a389067 100644 --- a/src/modules/extras/ModuleReplicateTest.ts +++ b/src/modules/extras/ModuleReplicateTest.ts @@ -4,7 +4,7 @@ import { LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_LEVEL_VERBOSE } from "octagonal-w import { eventHub } from "../../common/events"; import { getWebCrypto } from "../../lib/src/mods.ts"; import { uint8ArrayToHexString } from "octagonal-wheels/binary/hex"; -import { parseYaml, requestUrl, stringifyYaml } from "obsidian"; +import { parseYaml, requestUrl, stringifyYaml } from "@/deps.ts"; import type { FilePath } from "../../lib/src/common/types.ts"; import { scheduleTask } from "octagonal-wheels/concurrency/task"; import { getFileRegExp } from "../../lib/src/common/utils.ts"; diff --git a/src/modules/features/SettingDialogue/LiveSyncSetting.ts b/src/modules/features/SettingDialogue/LiveSyncSetting.ts index 4735f39..714ad88 100644 --- a/src/modules/features/SettingDialogue/LiveSyncSetting.ts +++ b/src/modules/features/SettingDialogue/LiveSyncSetting.ts @@ -6,7 +6,7 @@ import { ButtonComponent, type TextAreaComponent, type ValueComponent, -} from "obsidian"; +} from "@/deps.ts"; import { unique } from "octagonal-wheels/collection"; import { LEVEL_ADVANCED, diff --git a/test/harness/harness.ts b/test/harness/harness.ts index 87b22d2..329e532 100644 --- a/test/harness/harness.ts +++ b/test/harness/harness.ts @@ -1,4 +1,4 @@ -import { App } from "obsidian"; +import { App } from "@/deps.ts"; import ObsidianLiveSyncPlugin from "@/main"; import { DEFAULT_SETTINGS, type ObsidianLiveSyncSettings } from "@/lib/src/common/types"; import { LOG_LEVEL_VERBOSE, setGlobalLogFunction } from "@lib/common/logger"; diff --git a/test/suite/onlylocaldb.test.ts b/test/suite/onlylocaldb.test.ts index 930e4cf..3734ab8 100644 --- a/test/suite/onlylocaldb.test.ts +++ b/test/suite/onlylocaldb.test.ts @@ -1,6 +1,6 @@ import { beforeAll, describe, expect, it, test } from "vitest"; import { generateHarness, waitForIdle, waitForReady, type LiveSyncHarness } from "../harness/harness"; -import { TFile } from "obsidian"; +import { TFile } from "@/deps.ts"; import { DEFAULT_SETTINGS, type FilePath, type ObsidianLiveSyncSettings } from "@/lib/src/common/types"; import { isDocContentSame, readContent } from "@/lib/src/common/utils"; import { DummyFileSourceInisialised, generateBinaryFile, generateFile, init } from "../utils/dummyfile"; diff --git a/test/suite/sync.senario.basic.ts b/test/suite/sync.senario.basic.ts index 9214651..84b9935 100644 --- a/test/suite/sync.senario.basic.ts +++ b/test/suite/sync.senario.basic.ts @@ -16,7 +16,7 @@ import { checkStoredFileInDB, testFileRead, testFileWrite } from "./db_common"; import { delay } from "@/lib/src/common/utils"; import { commands } from "vitest/browser"; import { closeReplication, performReplication, prepareRemote } from "./sync_common"; -import type { DataWriteOptions } from "obsidian"; +import type { DataWriteOptions } from "@/deps.ts"; type MTimedDataWriteOptions = DataWriteOptions & { mtime: number }; export type TestOptions = {