mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
Fixed CSS Preload Error
This commit is contained in:
@@ -14,6 +14,7 @@ import { initVectorSearch } from "../search/vector/vectorSearch";
|
|||||||
import { cleanupSearchBar, mountSearchBar } from "./mountSearchBar";
|
import { cleanupSearchBar, mountSearchBar } from "./mountSearchBar";
|
||||||
import { IndexedDbManager } from "embeddia";
|
import { IndexedDbManager } from "embeddia";
|
||||||
import { VectorWorkerManager } from "../indexing/worker/vectorWorkerManager";
|
import { VectorWorkerManager } from "../indexing/worker/vectorWorkerManager";
|
||||||
|
import { checkAndHandleUpdate } from "../utils/versionCheck";
|
||||||
|
|
||||||
// Platform-aware default hotkey
|
// Platform-aware default hotkey
|
||||||
const getDefaultHotkey = () => {
|
const getDefaultHotkey = () => {
|
||||||
@@ -152,15 +153,25 @@ const globalSearchPlugin: Plugin<typeof settings> = {
|
|||||||
const appRef = { current: null };
|
const appRef = { current: null };
|
||||||
|
|
||||||
// Check for extension updates and clear caches if needed
|
// Check for extension updates and clear caches if needed
|
||||||
try {
|
// Use a timeout to avoid blocking initialization
|
||||||
const { checkAndHandleUpdate } = await import("../utils/versionCheck");
|
setTimeout(async () => {
|
||||||
const wasUpdated = await checkAndHandleUpdate();
|
try {
|
||||||
if (wasUpdated) {
|
const wasUpdated = await checkAndHandleUpdate();
|
||||||
console.log("[Global Search] Extension updated - caches cleared");
|
if (wasUpdated) {
|
||||||
|
console.log("[Global Search] Extension updated - caches cleared");
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
// Handle CSS preload errors and other failures gracefully
|
||||||
|
// These can happen in Firefox or when assets aren't available
|
||||||
|
if (error?.message?.includes("preload CSS") ||
|
||||||
|
error?.message?.includes("MIME type") ||
|
||||||
|
error?.message?.includes("NS_ERROR_CORRUPTED_CONTENT")) {
|
||||||
|
console.debug("[Global Search] Version check skipped due to asset loading restrictions:", error.message);
|
||||||
|
} else {
|
||||||
|
console.warn("[Global Search] Failed to check for updates:", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
}, 100);
|
||||||
console.warn("[Global Search] Failed to check for updates:", error);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await IndexedDbManager.create("embeddiaDB", "embeddiaObjectStore", {
|
await IndexedDbManager.create("embeddiaDB", "embeddiaObjectStore", {
|
||||||
|
|||||||
@@ -90,6 +90,8 @@
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
|
max-width: 200px;
|
||||||
|
height: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-progress-bar-wrapper {
|
.search-progress-bar-wrapper {
|
||||||
@@ -99,6 +101,7 @@
|
|||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: none;
|
display: none;
|
||||||
|
min-width: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .search-progress-bar-wrapper {
|
.dark .search-progress-bar-wrapper {
|
||||||
@@ -111,6 +114,7 @@
|
|||||||
transition: width 0.3s ease-out;
|
transition: width 0.3s ease-out;
|
||||||
width: 0%;
|
width: 0%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-progress-bar::after {
|
.search-progress-bar::after {
|
||||||
@@ -119,6 +123,7 @@
|
|||||||
inset: 0;
|
inset: 0;
|
||||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
||||||
animation: shimmer 2s infinite;
|
animation: shimmer 2s infinite;
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-progress-text {
|
.search-progress-text {
|
||||||
@@ -126,6 +131,7 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
display: none;
|
display: none;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .search-progress-text {
|
.dark .search-progress-text {
|
||||||
|
|||||||
@@ -84,19 +84,28 @@ export async function clearAllCaches(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Also try to directly clear caches if modules are already loaded
|
// Also try to directly clear caches if modules are already loaded
|
||||||
try {
|
// Use setTimeout to avoid blocking and handle CSS preload errors
|
||||||
const { clearSearchCache } = await import("../search/searchUtils");
|
setTimeout(async () => {
|
||||||
clearSearchCache();
|
try {
|
||||||
} catch (e) {
|
const { clearSearchCache } = await import("../search/searchUtils");
|
||||||
// Module might not be loaded yet, that's okay
|
clearSearchCache();
|
||||||
}
|
} catch (e: any) {
|
||||||
|
// Module might not be loaded yet, or CSS preload error - that's okay
|
||||||
try {
|
if (!e?.message?.includes("preload CSS") && !e?.message?.includes("MIME type")) {
|
||||||
const { clearEmbeddingCache } = await import("../search/vector/vectorSearch");
|
console.debug("[Version Check] Could not clear search cache:", e);
|
||||||
clearEmbeddingCache();
|
}
|
||||||
} catch (e) {
|
}
|
||||||
// Module might not be loaded yet, that's okay
|
|
||||||
}
|
try {
|
||||||
|
const { clearEmbeddingCache } = await import("../search/vector/vectorSearch");
|
||||||
|
clearEmbeddingCache();
|
||||||
|
} catch (e: any) {
|
||||||
|
// Module might not be loaded yet, or CSS preload error - that's okay
|
||||||
|
if (!e?.message?.includes("preload CSS") && !e?.message?.includes("MIME type")) {
|
||||||
|
console.debug("[Version Check] Could not clear embedding cache:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
|
|
||||||
console.debug("[Version Check] All caches cleared");
|
console.debug("[Version Check] All caches cleared");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user