Implement a Resilient React Transaction Feed with Optimistic Updates
Quick Overview
Build a React transaction feed with polling, optimistic rows, bounded retries, currency filters and totals, and persistent filters without losing pending payments.
Implement a Resilient React Transaction Feed with Optimistic Updates
Company: Circle
Role: Frontend Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Onsite
Implement a React transaction interface against a provided backend. Poll transactions because no history API is available, show at most 25 rows, submit transactions through a validated form, and keep newly submitted transactions visible while polling continues. Handle intermittent request errors and retries.
Extend it to filter all payments known to the client while displaying at most 25 matching rows; search by a comma-separated set of currencies from `usd`, `btc`, `eur`, `jpy`, and `gbp`; show per-currency totals; and preserve filters across page navigation. Show a submitted transaction immediately, its retry count (at most five retries), and pending/confirmed state.
### Constraints & Assumptions
Backend URL, response schema, historical pagination, and idempotency support are not provided. Use adapters to the supplied API. A client cannot recover payments it has never received from a backend with no history endpoint; clarify whether “all” means all observed payments or requires a backend extension.
### Clarifying Questions to Ask
- Is there a stable transaction ID or client idempotency key for reconciling optimistic rows?
- Does five mean five retries after the initial attempt or five total attempts? This practice version uses five retries.
- Do currency totals cover all filtered payments or only the displayed 25? Use all filtered observed payments here.
```hint Keep server observations and local intent separate
A poll response should not erase a transaction that the user just submitted but the server has not yet returned.
```
### What a Strong Answer Covers
- Normalized retained transactions, a separate optimistic submission state, and stable reconciliation keys.
- Filtering before slicing, per-currency arithmetic, and persistent filter state.
- Poll cancellation/stale-response protection, bounded retry, and a row-level status machine.
### Follow-up Questions
- How can the UI distinguish a lost success response from a failed payment submission?
- How would true all-history filtering work after a browser restart?
Overview: Build a React transaction feed with polling, optimistic rows, bounded retries, currency filters and totals, and persistent filters without losing pending payments.
Implement a React transaction interface against a provided backend. Poll transactions because no history API is available, show at most 25 rows, submit transactions through a validated form, and keep newly submitted transactions visible while polling continues. Handle intermittent request errors and retries.
Extend it to filter all payments known to the client while displaying at most 25 matching rows; search by a comma-separated set of currencies from usd, btc, eur, jpy, and gbp; show per-currency totals; and preserve filters across page navigation. Show a submitted transaction immediately, its retry count (at most five retries), and pending/confirmed state.
Constraints & Assumptions
Backend URL, response schema, historical pagination, and idempotency support are not provided. Use adapters to the supplied API. A client cannot recover payments it has never received from a backend with no history endpoint; clarify whether “all” means all observed payments or requires a backend extension.
Clarifying Questions to Ask Guidance
Is there a stable transaction ID or client idempotency key for reconciling optimistic rows?
Does five mean five retries after the initial attempt or five total attempts? This practice version uses five retries.
Do currency totals cover all filtered payments or only the displayed 25? Use all filtered observed payments here.
What a Strong Answer Covers Guidance
Normalized retained transactions, a separate optimistic submission state, and stable reconciliation keys.
Filtering before slicing, per-currency arithmetic, and persistent filter state.
Poll cancellation/stale-response protection, bounded retry, and a row-level status machine.
Follow-up Questions Guidance
How can the UI distinguish a lost success response from a failed payment submission?
How would true all-history filtering work after a browser restart?