Component extraction cover

When to Extract a Component (and When to Just Copy-Paste)

Early in building Polaris, I extracted a ConfirmDialog component after using it exactly once. I figured I’d need it everywhere — deletes, password changes, dangerous actions. Classic foresight. Then the second use case needed a text input inside the dialog. The third needed two buttons with custom labels instead of “Confirm/Cancel”. The fourth needed async validation before confirming. Within a month, my clean ConfirmDialog had 8 props, 3 slots, and a mode prop that changed its behavior entirely. ...

February 12, 2025 · 3 min · Muhammad Hassan Raza
Invoice search performance cover

The Invoice Page That Took 4 Seconds to Search

In Polaris, the POS system I built for retail shops, the invoice page has a product search bar. A cashier types a product name, results appear, they click to add it to the invoice. Simple. Except it wasn’t. Every keystroke fired an API call. On a shop with 500 products, search took 3-4 seconds because each request hit the database, serialized the response, and traveled back over the network. Cashiers were waiting on every single search. During rush hours, this was painful. ...

February 11, 2025 · 2 min · Muhammad Hassan Raza