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(settings): restore temporary save-success styling (#7850)

LearningCircuited40ab75cb53
diff --git a/changelog.d/7044.bugfix.md b/changelog.d/7044.bugfix.md
new file mode 100644
index 0000000000..99b9368d61
--- /dev/null
+++ b/changelog.d/7044.bugfix.md
@@ -0,0 +1 @@
+Match settings save-success styles to the class applied to saved fields, keep a field's error border visible when a save fails right after a success, and drop the unused `.saving` spinner styles.
diff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.js
index 7f9d98aae6..4eedfa9d70 100644
--- a/src/local_deep_research/web/static/js/components/settings.js
+++ b/src/local_deep_research/web/static/js/components/settings.js
@@ -4951,38 +4951,14 @@
document.head.appendChild(styleEl);
}
- // Add CSS for saving and success states
+ // Add CSS for success and spinner states
styleEl.textContent = `
- .saving {
- opacity: 0.7;
- pointer-events: none;
- position: relative;
- }
-
- .saving::after {
- content: '';
- position: absolute;
- top: 50%;
- right: 10px;
- width: 16px;
- height: 16px;
- margin-top: -8px;
- border: 2px solid rgba(var(--accent-primary-rgb), 0.1);
- border-top-color: var(--accent-primary);
- border-radius: 50%;
- animation: spinner 0.8s linear infinite;
- z-index: 10;
- }
-
- .save-success {
+ /* An error state always wins over a lingering success flash. */
+ .ldr-save-success:not(.ldr-settings-error) {
border-color: var(--success-color) !important;
transition: border-color 0.3s;
}
- @keyframes spinner {
- to { transform: rotate(360deg); }
- }
-
.spinner {
width: 40px;
height: 40px;
diff --git a/tests/js/components/settings-submit-runtime.test.js b/tests/js/components/settings-submit-runtime.test.js
index 0e71050744..05b080fffe 100644
--- a/tests/js/components/settings-submit-runtime.test.js
+++ b/tests/js/components/settings-submit-runtime.test.js
@@ -787,3 +787,64 @@ it('falls back to a top-level error field when the body carries no message', asy
5000,
);
});
+
+it('styles the class the save path applies with the injected success rule', async () => {
+ // Reverting the injected selector to `.save-success` (issue #7044) keeps
+ // every classList assertion green: showSaveSuccess() applies
+ // `ldr-save-success` regardless of the rule text, so the green border
+ // silently stops painting. This guard pins the rule↔class pairing by
+ // discovering the applied class from the real save path and requiring
+ // the `#settings-dynamic-styles` template to style exactly that class,
+ // with no orphan rule left for the retired class name.
+ const fetchMock = vi.fn().mockResolvedValue(jsonResponse({
+ status: 'success',
+ }));
+ vi.stubGlobal('fetch', fetchMock);
+
+ submitSettingsForm();
+ await flushPromises();
+
+ // resetForm() clears the class list, so the success window is the only
+ // state left on the form when the bulk save resolves.
+ const appliedClasses = [...document.getElementById('settings-form').classList];
+ expect(appliedClasses).toEqual(['ldr-save-success']);
+
+ // Parse the rules production actually injected into the document.
+ const styleEl = document.getElementById('settings-dynamic-styles');
+ expect(styleEl).not.toBeNull();
+ const selectorTexts = [...styleEl.sheet.cssRules]
+ .map((rule) => rule.selectorText)
+ .filter(Boolean)
+ .flatMap((text) => text.split(',').map((selector) => selector.trim()));
+
+ // The applied success class must be covered: a bare element carrying
+ // exactly what showSaveSuccess() leaves behind must match some rule.
+ const successProbe = document.createElement('div');
+ successProbe.className = appliedClasses.join(' ');
+ expect(selectorTexts.some((selector) => successProbe.matches(selector)))
+ .toBe(true);
+
+ // No orphan rule may remain for the retired class name: nothing applies
+ // `.save-success`, so a selector matching it can never paint.
+ const legacyProbe = document.createElement('div');
+ legacyProbe.className = 'save-success';
+ const orphanSelectors = selectorTexts.filter(
+ (selector) => legacyProbe.matches(selector),
+ );
+ expect(orphanSelectors).toEqual([]);
+
+ // A save that errors inside the 1.5 s success window leaves both classes
+ // on the field; the success border (also !important, injected later in
+ // the cascade) must not mask the `.ldr-settings-error` red border.
+ const erroredProbe = document.createElement('div');
+ erroredProbe.className = 'ldr-save-success ldr-settings-error';
+ expect(selectorTexts.filter((selector) => erroredProbe.matches(selector)))
+ .toEqual([]);
+
+ // The retired `.saving` spinner rules are gone too: the save path only
+ // applies `ldr-saving`, which settings.css already styles.
+ const savingProbe = document.createElement('div');
+ savingProbe.className = 'saving';
+ expect(selectorTexts.filter((selector) => savingProbe.matches(selector)))
+ .toEqual([]);
+});
diff --git a/tests/ui_tests/test_api_key_comprehensive.js b/tests/ui_tests/test_api_key_comprehensive.js
index 75fa93969f..51f57cf140 100644
--- a/tests/ui_tests/test_api_key_comprehensive.js
+++ b/tests/ui_tests/test_api_key_comprehensive.js
@@ -285,15 +285,15 @@ async function runComprehensiveApiKeyTest() {
{ timeout: 5000 }
).catch(() => log('No saving indicator detected', 'warn'));
- // Then wait for save-success class or toast message
+ // Then wait for ldr-save-success class or toast message
const successIndicators = await page.waitForFunction(
() => {
const indicators = [];
- // Check for save-success class on input
+ // Check for ldr-save-success class on input
const input = document.querySelector('input[name="llm.openai_endpoint.api_key"]');
- if (input && input.classList.contains('save-success')) {
- indicators.push('Input has save-success class');
+ if (input && input.classList.contains('ldr-save-success')) {
+ indicators.push('Input has ldr-save-success class');
}
// Check for toast notifications