* Refreshes the TaskNotes cache by clearing all cached data and re-initializing
()
| 1384 | * Refreshes the TaskNotes cache by clearing all cached data and re-initializing |
| 1385 | */ |
| 1386 | async refreshCache(): Promise<void> { |
| 1387 | try { |
| 1388 | // Show loading notice |
| 1389 | const loadingNotice = new Notice("Refreshing tasknotes cache...", 0); |
| 1390 | |
| 1391 | // Clear all caches |
| 1392 | await this.cacheManager.clearAllCaches(); |
| 1393 | |
| 1394 | // Notify all views to refresh |
| 1395 | this.notifyDataChanged(undefined, true, true); |
| 1396 | this.emitter.trigger(TASKNOTES_RUNTIME_LIFECYCLE_RAW_EVENTS["cache.rebuilt"], { |
| 1397 | force: true, |
| 1398 | timestamp: new Date().toISOString(), |
| 1399 | }); |
| 1400 | |
| 1401 | // Hide loading notice and show success |
| 1402 | loadingNotice.hide(); |
| 1403 | new Notice("Tasknotes cache refreshed successfully"); |
| 1404 | } catch (error) { |
| 1405 | tasknotesLogger.error("Error refreshing cache:", { |
| 1406 | category: "stale-data", |
| 1407 | operation: "refreshing-cache", |
| 1408 | error: error, |
| 1409 | }); |
| 1410 | new Notice("Failed to refresh cache. Please try again."); |
| 1411 | } |
| 1412 | } |
| 1413 | |
| 1414 | /** |
| 1415 | * Convert any checkbox task on current line to TaskNotes task |
no test coverage detected