FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
fix: TypeScript errors in auto-updater progress tracking
tilakpatel22fde48c5b667c
diff --git a/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx b/fincept-terminal-desktop/src/components/common/AutoUpdater.tsxindex 43987f520..0be133bea 100644--- a/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx+++ b/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx@@ -81,14 +81,20 @@ export function AutoUpdater({ checkOnMount = true, checkIntervalMinutes = 30 }:console.log('[AutoUpdater] Starting download and installation...');// Download and install with progress tracking+ let totalBytes = 0;+ let downloadedBytes = 0;+await updateInfo.downloadAndInstall((event) => {switch (event.event) {case 'Started':- console.log(`[AutoUpdater] Download started - Total size: ${event.data.contentLength} bytes`);+ totalBytes = (event.data as any).contentLength || 0;+ downloadedBytes = 0;+ console.log(`[AutoUpdater] Download started - Total size: ${totalBytes} bytes`);setDownloadProgress(0);break;case 'Progress':- const progress = (event.data.chunkLength / (event.data.contentLength || 1)) * 100;+ downloadedBytes += event.data.chunkLength;+ const progress = totalBytes > 0 ? (downloadedBytes / totalBytes) * 100 : 0;console.log(`[AutoUpdater] Download progress: ${progress.toFixed(2)}%`);setDownloadProgress(progress);break;diff --git a/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts b/fincept-terminal-desktop/src/hooks/useAutoUpdater.tsindex 3fc99bc7e..6766cbda7 100644--- a/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts+++ b/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts@@ -90,14 +90,20 @@ export function useAutoUpdater(): UseAutoUpdaterReturn {console.log('[AutoUpdater] Starting download and installation...');// Download and install with progress tracking+ let totalBytes = 0;+ let downloadedBytes = 0;+await updateInfo.downloadAndInstall((event) => {switch (event.event) {case 'Started':- console.log(`[AutoUpdater] Download started - Size: ${event.data.contentLength} bytes`);+ totalBytes = (event.data as any).contentLength || 0;+ downloadedBytes = 0;+ console.log(`[AutoUpdater] Download started - Size: ${totalBytes} bytes`);setInstallProgress(0);break;case 'Progress':- const progress = (event.data.chunkLength / (event.data.contentLength || 1)) * 100;+ downloadedBytes += event.data.chunkLength;+ const progress = totalBytes > 0 ? (downloadedBytes / totalBytes) * 100 : 0;console.log(`[AutoUpdater] Download progress: ${progress.toFixed(2)}%`);setInstallProgress(Math.min(progress, 100));break;