feat: improve status handling and user feedback in SurfSense plugin

- Added refreshStatus method to update connection status immediately after settings changes.
- Enhanced error reporting with reportAuthError method for better authentication feedback.
- Updated status visuals in the status modal to reflect the new centralized structure.
- Improved connection handling in the settings tab to ensure accurate status representation.
This commit is contained in:
Anish Sarkar 2026-04-25 03:24:17 +05:30
parent 4f1c870987
commit 937965b335
5 changed files with 30 additions and 18 deletions

View file

@ -183,6 +183,7 @@ export default class SurfSensePlugin extends Plugin {
this.settings.vaultId !== previousVaultId ||
this.settings.connectorId !== previousConnectorId;
if (!changed) return;
this.engine?.refreshStatus();
this.notifyStatusChange();
if (this.settings.searchSpaceId !== null) {
void this.engine.ensureConnected();
@ -242,6 +243,7 @@ export default class SurfSensePlugin extends Plugin {
}
private notifyAuthError(): void {
this.engine?.reportAuthError();
const now = Date.now();
if (now - this.lastAuthToastAt < 10_000) return;
this.lastAuthToastAt = now;
@ -265,8 +267,6 @@ export default class SurfSensePlugin extends Plugin {
async saveSettings() {
await this.saveData(this.settings);
// Ensures the indicator reacts to settings edits (token paste, search-space pick)
// without waiting for the next sync trigger.
this.engine?.refreshStatus();
}