mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
refactor: use assetCacheManager for OCR data (#25437)
This commit is contained in:
parent
a96a08939e
commit
84679fb2b2
2 changed files with 4 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { assetCacheManager } from '$lib/managers/AssetCacheManager.svelte';
|
||||||
import { ocrManager, type OcrBoundingBox } from '$lib/stores/ocr.svelte';
|
import { ocrManager, type OcrBoundingBox } from '$lib/stores/ocr.svelte';
|
||||||
import { getAssetOcr } from '@immich/sdk';
|
import { getAssetOcr } from '@immich/sdk';
|
||||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
|
@ -30,6 +31,7 @@ describe('OcrManager', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Reset the singleton state before each test
|
// Reset the singleton state before each test
|
||||||
ocrManager.clear();
|
ocrManager.clear();
|
||||||
|
assetCacheManager.clearOcrCache();
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { assetCacheManager } from '$lib/managers/AssetCacheManager.svelte';
|
||||||
import { CancellableTask } from '$lib/utils/cancellable-task';
|
import { CancellableTask } from '$lib/utils/cancellable-task';
|
||||||
import { getAssetOcr } from '@immich/sdk';
|
|
||||||
|
|
||||||
export type OcrBoundingBox = {
|
export type OcrBoundingBox = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -38,7 +38,7 @@ class OcrManager {
|
||||||
this.#cleared = false;
|
this.#cleared = false;
|
||||||
}
|
}
|
||||||
await this.#ocrLoader.execute(async () => {
|
await this.#ocrLoader.execute(async () => {
|
||||||
this.#data = await getAssetOcr({ id });
|
this.#data = await assetCacheManager.getAssetOcr(id);
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue