Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Fixes

Edward Cui5b37a68396c9
diff --git a/client/src/lib/import/csv-worker-manager.ts b/client/src/lib/import/csv-worker-manager.ts
index 781598622..a7dbd15ad 100644
--- a/client/src/lib/import/csv-worker-manager.ts
+++ b/client/src/lib/import/csv-worker-manager.ts
@@ -205,7 +205,7 @@ export class CSVWorkerManager {
// Mark as completed
this.completedUploads.add(chunkIndex);
this.progress.uploadedBatches++;
- this.progress.importedEvents += data.importedCount || events.length;
+ this.progress.importedEvents += data.importedCount ?? events.length;
this.activeUploads--;
this.notifyProgress();
diff --git a/client/src/workers/csv-import.worker.ts b/client/src/workers/csv-import.worker.ts
index f4c7dac2a..22319bfa9 100644
--- a/client/src/workers/csv-import.worker.ts
+++ b/client/src/workers/csv-import.worker.ts
@@ -187,7 +187,6 @@ function parseCSV(file: File) {
Papa.parse<UmamiEvent>(file, {
header: true,
- dynamicTyping: true, // Auto-convert strings to numbers/booleans
skipEmptyLines: "greedy", // Skip all empty lines (improved)
delimiter: "", // Auto-detect delimiter (comma, tab, semicolon, etc.)
transformHeader: (header, index) => {
diff --git a/server/src/api/sites/deleteSiteImport.ts b/server/src/api/sites/deleteSiteImport.ts
index 4ee3e7166..a340d9bf3 100644
--- a/server/src/api/sites/deleteSiteImport.ts
+++ b/server/src/api/sites/deleteSiteImport.ts
@@ -49,19 +49,6 @@ export async function deleteSiteImport(request: FastifyRequest<DeleteImportReque
const siteId = Number(site);
- // Delete the import record from the database FIRST (fail fast)
- // If this fails, we haven't deleted any data yet
- try {
- await deleteImport(importId);
- } catch (dbError) {
- console.error(`Failed to delete import record ${importId}:`, dbError);
- return reply.status(500).send({
- error: "Failed to delete import record",
- });
- }
-
- // Delete events from ClickHouse that were imported with this importId
- // This is a critical operation - if it fails, we fail the entire deletion
try {
await clickhouse.command({
query: `DELETE FROM events WHERE import_id = {importId:String} AND site_id = {siteId:UInt16}`,
@@ -74,7 +61,16 @@ export async function deleteSiteImport(request: FastifyRequest<DeleteImportReque
} catch (chError) {
console.error(`Failed to delete ClickHouse events for ${importId}:`, chError);
return reply.status(500).send({
- error: "Failed to delete imported events from database",
+ error: "Failed to delete imported events",
+ });
+ }
+
+ try {
+ await deleteImport(importId);
+ } catch (dbError) {
+ console.error(`Failed to delete import record ${importId}:`, dbError);
+ return reply.status(500).send({
+ error: "Failed to delete import record",
});
}