(ref: RepoRef, graphData: any)
| 118 | }; |
| 119 | |
| 120 | const cacheGraph = async (ref: RepoRef, graphData: any): Promise<void> => { |
| 121 | try { |
| 122 | const db = await openDB(); |
| 123 | return new Promise((resolve, reject) => { |
| 124 | const transaction = db.transaction(STORE_NAME, "readwrite"); |
| 125 | const store = transaction.objectStore(STORE_NAME); |
| 126 | const request = store.put({ |
| 127 | key: getCacheKey(ref), |
| 128 | graphData, |
| 129 | timestamp: Date.now() |
| 130 | }); |
| 131 | request.onerror = () => reject(request.error); |
| 132 | request.onsuccess = () => resolve(); |
| 133 | }); |
| 134 | } catch (e) { |
| 135 | console.error("Failed to write to IndexedDB", e); |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | // ============================================================================ |
| 140 | // FETCH WITH PROGRESS TRACKING |
no test coverage detected