Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

change updateIndexStatus to get

Abhinavf473c92225b2
diff --git a/apps/photos/src/components/Sidebar/AdvancedSettings.tsx b/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
index 862033de83..b02a3b8d8a 100644
--- a/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
+++ b/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
@@ -52,15 +52,13 @@ export default function AdvancedSettings({ open, onClose, onRootClose }) {
});
useEffect(() => {
- ClipService.setOnUpdateHandler(setIndexingStatus);
+ const main = async () => {
+ setIndexingStatus(await ClipService.getIndexingStatus());
+ ClipService.setOnUpdateHandler(setIndexingStatus);
+ };
+ main();
}, []);
- useEffect(() => {
- if (open) {
- ClipService.updateIndexStatus();
- }
- }, [open]);
-
return (
<EnteDrawer
transitionDuration={0}
diff --git a/apps/photos/src/services/clipService.ts b/apps/photos/src/services/clipService.ts
index 89c9fa0c23..e4521f6a07 100644
--- a/apps/photos/src/services/clipService.ts
+++ b/apps/photos/src/services/clipService.ts
@@ -86,14 +86,18 @@ class ClipServiceImpl {
}
};
- updateIndexStatus = async () => {
+ getIndexingStatus = async () => {
try {
- addLogLine('loading local clip index status');
- this.clipExtractionStatus = await getClipExtractionStatus();
- this.onUpdateHandler(this.clipExtractionStatus);
- addLogLine('loaded local clip index status');
+ if (
+ !this.clipExtractionStatus ||
+ (this.clipExtractionStatus.pending === 0 &&
+ this.clipExtractionStatus.indexed === 0)
+ ) {
+ this.clipExtractionStatus = await getClipExtractionStatus();
+ }
+ return this.clipExtractionStatus;
} catch (e) {
- logError(e, 'failed to load local clip index status');
+ logError(e, 'failed to get clip indexing status');
}
};