← Back to Projects

Mapup EV Dashboard

Frontend Developer · Completed

Live Demo Private Repo

Overview

Analytics dashboard for 50,000 Washington electric-vehicle registration records. The dataset CSV is downloaded once, parsed once in the browser (Papa Parse inside a Web Worker) and cached in IndexedDB, so repeat visits make no network request for it. KPI cards, charts and the records table load behind skeleton placeholders, and a filter-chip click re-renders only the records table: in same-machine before/after tests the median click fell from about 320–420 ms to about 70–90 ms.

Key Highlights

  • ▹50,000-record dataset; filter chips update the table in about 0.1 s (median 72–92 ms in paired headed-Chrome tests, down from 320–416 ms; not every click is under 100 ms) and each typed search letter paints in about 40 ms
  • ▹Client-side CSV parsing with Papa Parse in a Web Worker, cached in IndexedDB: one download of the static file on the first visit, none afterwards; a cold load reaches a populated dashboard in 2.5 s (was 27.8 s)
  • ▹Skeleton screens instead of a blocking loader; a stalled download is cancelled, retried and reported with a Retry button instead of hanging
  • ▹A filter change re-renders only the records table (React Profiler: 0 of 10 KPI and chart panels re-rendered, was all 10)
  • ▹Charts built with MUI X Charts; the records table is the MUI X Data Grid in server mode over an in-memory query engine, 20 rows rendered per page

Tech Stack

React.jsMUI X ChartsMUI X Data GridPapa ParseWeb WorkersIndexedDB (Dexie)Jest

Problem & Business Goal

The dashboard explores 50,000 rows of Washington State electric-vehicle registrations (make, model, year, electric range, location, vehicle type). Its case study claimed sub-100 ms interactions, one-time client-side parsing and skeleton screens. Measured on the live demo those claims did not hold: a filter-chip click took 552–784 ms, each typed letter in the search about 225 ms, and the first load behind a full-screen overlay once stayed on screen for minutes.

I treated the claims as requirements and ran one loop: measure with Chrome's Event Timing on real clicks, find the cause with a React commit profile and a CPU trace, fix the largest phase, and measure again with the same method. The numbers below are what came out, including the one target that was only partly met.

Architecture

Data path: the CSV (12 MB raw, about 1.4 MB gzipped) is handled by a Web Worker. It checks an IndexedDB cache first; on a miss it downloads the file once (with a 20-second stall watchdog and three attempts), runs one Papa Parse, normalizes the rows, and computes the KPI and chart aggregates. The small aggregates are posted to the page first, then the 50,000 table rows in chunks of 5,000. The cache is ten chunk records plus one metadata record that also holds the aggregates; it is written after the UI is already complete, and reading it is time-limited so a stuck IndexedDB falls back to the network.

UI: React 18 with MUI X Charts for the chart panels and the MUI X Data Grid for the records table. The grid runs in server mode over a small in-memory query engine: preset chips, quick search, the grid's own filter-panel operators, sorting and paging are answered by one cached pass over typed-array columns, so the grid only ever renders a page of 20 rows. State is split so a change touches only what it affects: the chip state lives in the records section, every chart and KPI card is memoized, and the search text lives below the theme provider.

Challenges & Solution

The slow clicks were not the filter itself. A React commit profile showed one chip click re-rendering about 3,850 components: every KPI card and chart plus four Data Grid commits. Moving the chip state into the records section and memoizing the panels fixed clicks but not typing: MUI's ThemeProvider builds a new theme object whenever it re-renders, and a changed theme context re-renders every themed component whatever React.memo says. Holding the search text below the theme provider removed it.

The first-load stall was reproduced, not guessed at. The overlay waited for a 50,000-record IndexedDB write (ten indexes nothing queried, written on the main thread), which took 13–35 s here although the CSV arrived in 0.7 s; on a slow disk it can take minutes, and a reload then worked because the cache had finished meanwhile. A half-dead connection hung forever because the download had no timeout. The cache now stores ten large chunks, is written after the UI is complete, and the download cancels itself after 20 s without data, retries twice and then shows a Retry button.

What remains is the grid: swapping one page of rows in the MUI Data Grid costs about 70–130 ms on this machine (a plain next-page click measures the same), so the last stretch to 100 ms is bounded by the grid itself. Measurement was its own problem too: this machine's speed varied 2–3× between runs, so before and after builds were opened side by side and clicked in alternating order, and one result was cross-checked against the DevTools trace (Event Timing 216 ms, trace 212.1 ms, Interactions track 212 ms).

Performance Optimizations

Production build, Chrome 157 on Windows (12 cores), no throttling, paired before/after runs. Filter-chip click, median: 320–416 ms before and 72–92 ms after in headed Chrome (18 clicks per chip; 10–13 of 18 under 100 ms, slowest 216 ms); 148–168 ms after in headless Chrome. A typed search letter paints in 40 ms (was 504 ms) and the filtered rows are on screen in 153 ms (was 559 ms).

First load on localhost: cold load to a populated dashboard 27.8 s (13.6–34.7) before, 2.5 s after; warm load 3.0 s to 1.5 s; total blocking time 5.8 s to 0.8 s; main bundle 434.5 kB to 385 kB gzipped. Per chip click: 5–6 React commits to 3–4, about 3,850 component renders to about 2,030, React render time 220–315 ms to 74–129 ms. A stalled CSV connection: overlay forever with no error before; recovery in 25 s, or an error with Retry after 64 s, after.

Lessons Learned

Measure the claim before defending it: the real causes (a 50,000-record cache write, a theme object defeating memoization) were not where I would have looked, and a duplicate parser, an empty worker stub and two unused libraries turned up along the way. When the machine is noisy, compare builds side by side rather than across runs. Report the number that came out: the 100 ms target is met by the median in headed Chrome but not by every click, and the case study now says exactly that. Pagination is not virtualization: the grid renders 20 rows, and the wording says so.

Future Improvements

Deploy the fixed build and re-measure the live demo (it still runs the earlier version until deployed); try a lighter row renderer if every click must stay under 100 ms, since the Data Grid alone costs 70–130 ms per page swap here; replace the demo-only login with a real auth provider.