fix: increment DB version and improve ads parsing robustness

This commit is contained in:
Christian Vidal Wolf
2026-01-21 10:52:30 +01:00
parent e5c72c48c5
commit 1c2a0e86aa
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -201,9 +201,9 @@ const App: React.FC = () => {
await saveAdsData(data);
console.log("Ads loaded:", data.length, "records from", file.name);
setIsDataModalOpen(false);
} catch (error) {
} catch (error: any) {
console.error("Failed to parse Ads file", error);
alert("Error parsing Ads file. Please check the format.");
alert(`Error parsing Ads file: ${error.message || 'Unknown error'}. Please check the format.`);
} finally {
setSyncing(false);
}
+1 -1
View File
@@ -357,7 +357,7 @@ export const processAdsExcel = async (fileOrBuffer: File | ArrayBuffer): Promise
const arrayBuffer = fileOrBuffer instanceof File
? await fileOrBuffer.arrayBuffer()
: fileOrBuffer;
const workbook = XLSX.read(arrayBuffer);
const workbook = XLSX.read(arrayBuffer, { type: 'array' });
const allData: AdsRecord[] = [];
// Process ALL sheets (e.g., "2025", "2026")
+1 -1
View File
@@ -4,7 +4,7 @@ import { SalesRecord } from '../types';
const DB_NAME = 'CrazeAnalytixDB';
const STORE_NAME = 'salesData';
const ADS_STORE_NAME = 'adsData';
const DB_VERSION = 1;
const DB_VERSION = 2;
// Increment this when data processing logic changes (e.g., field mapping changes)
// This forces cache invalidation and re-processing of CSV data
const DATA_SCHEMA_VERSION = 2; // Updated for LICENSE column mapping