Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(collection_details): avoid showError global shadowing (#6719)

Mateeh Ullah48d562626d31
diff --git a/src/local_deep_research/web/static/js/collection_details.js b/src/local_deep_research/web/static/js/collection_details.js
index 5a1cc10c3b..e89e4887a9 100644
--- a/src/local_deep_research/web/static/js/collection_details.js
+++ b/src/local_deep_research/web/static/js/collection_details.js
@@ -110,13 +110,13 @@ function queueCollectionBooleanUpdate({
} else if (intentId === state.latestIntentId) {
state.latestIntentPending = false;
toggle.checked = state.confirmedValue;
- showError('Failed to update collection: ' + (data.error || 'unknown error'));
+ showCollectionError('Failed to update collection: ' + (data.error || 'unknown error'));
}
} catch {
if (intentId !== state.latestIntentId) return;
state.latestIntentPending = false;
toggle.checked = state.confirmedValue;
- showError(networkErrorMessage);
+ showCollectionError(networkErrorMessage);
}
};
@@ -252,12 +252,12 @@ async function loadCollectionDetails() {
// Show search section if any documents are indexed
initCollectionSearch();
} else {
- showError('Failed to load collection details: ' + data.error);
+ showCollectionError('Failed to load collection details: ' + data.error);
}
} catch (error) {
if (currentLoadId !== collectionDetailsLoadId) return;
SafeLogger.error('Error loading collection details:', error);
- showError('Failed to load collection details');
+ showCollectionError('Failed to load collection details');
}
}
@@ -548,11 +548,11 @@ async function indexCollection(forceReindex) {
if (!data.success) {
if (response.status === 409) {
// Already indexing
- showError(data.error || 'Indexing is already in progress');
+ showCollectionError(data.error || 'Indexing is already in progress');
showProgressUI();
startPolling();
} else {
- showError(data.error || 'Failed to start indexing');
+ showCollectionError(data.error || 'Failed to start indexing');
}
return;
}
@@ -566,7 +566,7 @@ async function indexCollection(forceReindex) {
} catch (error) {
SafeLogger.error('Error starting indexing:', error);
- showError('Failed to start indexing');
+ showCollectionError('Failed to start indexing');
}
}
@@ -807,11 +807,11 @@ async function cancelIndexing() {
progressText.textContent = 'Cancelling...';
addLogEntry('Cancellation requested...', 'warning');
} else {
- showError(data.error || 'Failed to cancel indexing');
+ showCollectionError(data.error || 'Failed to cancel indexing');
}
} catch (error) {
SafeLogger.error('Error cancelling indexing:', error);
- showError('Failed to cancel indexing');
+ showCollectionError('Failed to cancel indexing');
}
}
@@ -859,11 +859,11 @@ async function deleteCollection() {
window.location.href = '/library/collections';
}, 1000);
} else {
- showError('Failed to delete collection: ' + data.error);
+ showCollectionError('Failed to delete collection: ' + data.error);
}
} catch (error) {
SafeLogger.error('Error deleting collection:', error);
- showError('Failed to delete collection');
+ showCollectionError('Failed to delete collection');
}
}
@@ -877,7 +877,7 @@ function showSuccess(message) {
/**
* Show error message
*/
-function showError(message) {
+function showCollectionError(message) {
alert('Error: ' + message);
}
@@ -914,11 +914,11 @@ async function removeDocumentFromCollection(documentId) {
showSuccess(message);
loadCollectionDetails();
} else {
- showError('Failed to remove document: ' + data.error);
+ showCollectionError('Failed to remove document: ' + data.error);
}
} catch (error) {
SafeLogger.error('Error removing document:', error);
- showError('Failed to remove document');
+ showCollectionError('Failed to remove document');
}
}
}
@@ -952,11 +952,11 @@ async function deleteDocumentCompletely(documentId) {
showSuccess('Document deleted successfully');
loadCollectionDetails();
} else {
- showError('Failed to delete document: ' + data.error);
+ showCollectionError('Failed to delete document: ' + data.error);
}
} catch (error) {
SafeLogger.error('Error deleting document:', error);
- showError('Failed to delete document');
+ showCollectionError('Failed to delete document');
}
}
}
diff --git a/tests/web/test_notes_js_global_shadowing.py b/tests/web/test_notes_js_global_shadowing.py
index 7f67c6b698..5bd8197a95 100644
--- a/tests/web/test_notes_js_global_shadowing.py
+++ b/tests/web/test_notes_js_global_shadowing.py
@@ -52,18 +52,13 @@ _DECL_RE = re.compile(
# same-named top-level declaration later added to a base.html-shared
# script would crash with SyntaxError, not silently shadow it.
#
-# collection_details.js is deliberately NOT in this list: it is also
-# loaded on every page that loads delete_manager.js, but this file's
-# shared_names sweep is keyed on top-level names, and collection_details.js
-# already has an unrelated, pre-existing top-level `showError` that
-# collides with services/ui.js's own `showError` -- a real bug, but not
-# one this list exists to catch. See
-# test_collection_details_script_contracts.py for its (narrower)
-# formatBytes-only guard.
+# collection_details.js is included so its page-local helpers remain distinct
+# from the shared service layer loaded by base.html.
_NOTES_PAGE_SCRIPTS = [
"js/pages/note-detail.js",
"js/pages/notes.js",
"js/deletion/delete_manager.js",
+ "js/collection_details.js",
]