System Design

Design a Data Table (Sort / Filter / Virtualize)

mediumperformance

Design a Data Table (Sort / Filter / Virtualize)

Interview Prep mode active

Interview answer templates and key talking points. Switch the mode in the header to change your experience.

Asked In

SalesforceDatadogAirtableSnowflakeRetool

Key Challenges

  • ·Rendering 100,000+ rows while maintaining 60fps scrolling (Virtualization/Windowing)
  • ·Performant multi-column sorting and complex nested filtering on the client
  • ·Column Management: Resizing, reordering, and visibility toggling without layout thrashing
  • ·State Synchronization: URL-persistent state (filters/sorts) with back-button support
  • ·Accessibility (WCAG 2.1): Keyboard navigation (arrow keys), ARIA grid roles, and screen reader announcements
  • ·Real-time Updates: Handling live row updates/inserts without jumping the user's scroll position
  • ·Cell Rendering Optimization: Avoiding O(N) re-renders when a single cell value changes

Key Takeaways

  • Virtualization is mandatory for >100 rows; use 'Overscan' to prevent white gaps during rapid scrolling.
  • Normalize row data (Record<Id, Row>) for O(1) lookups during selection or updates.
  • Fixed headers/columns should use 'sticky' positioning or a split-pane layout for performance.
  • For complex tables, use the 'Headless Table' pattern (e.g., TanStack Table) to separate logic from UI.
  • Debounce filter inputs to 150-300ms to avoid locking the UI thread during typing.
  • Use 'Intersection Observer' or 'Resize Observer' for dynamic row heights and responsive column resizing.