Validating 10,000-Row CSV Uploads in 20ms Before Touching Your Server (React + IndexedDB)
Watch someone import a 10,000-row billing CSV over spotty Wi-Fi on a standard web app. They pick the file, wait ten seconds for the progress bar to crawl to 100%, and get bounced back by a red toast: 400 Bad Request: Invalid amount on row 7,500. So they fix row 7,500, re-upload the entire file, and discover another typo on row 8,102. If their connection drops while they are editing rows in your…
A researcher demonstrates how a 10,000 row CSV file can be validated in just 20 milliseconds before being sent to a server. Using React and IndexedDB, a TypeScript preflight check can verify the data locally without impacting server performance. The solution avoids the performance issues caused by duplicate ID detection in array scans, which can freeze tabs and take up to a second on mid-range laptops.
By replacing the array scan with a Set in the validation process, the duplicate detection becomes O(1) per row. Additionally, the researcher provides a small IndexedDB helper that allows multi-megabyte drafts to survive offline refreshes. This setup results in faster data processing, reduced network usage, and improved user experience when dealing with large CSV uploads.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.