Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiDataGrid] Memoization & perf improvements #7556

Merged
merged 20 commits into from
Mar 12, 2024

Commits on Mar 7, 2024

  1. [docs] Pull out all inline renderCellValue functions/components to …

    …static definitions
    
    - setting better perf examples for devs
    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    7b8bd12 View commit details
    Browse the repository at this point in the history
  2. [tests] Pull out inline renderCellValue fns/components to static de…

    …finitions
    
    + update snapshots
    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    871ff63 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    293bf9c View commit details
    Browse the repository at this point in the history
  4. Add basic useMemo usages

    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    e6888c5 View commit details
    Browse the repository at this point in the history
  5. Add more complex useMemo usages

    squash with complex useMemo
    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    eea719d View commit details
    Browse the repository at this point in the history
  6. Add basic useCallback usages

    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    4ed410a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e1bdcb2 View commit details
    Browse the repository at this point in the history
  8. Memoize CellWrapper + rename it to match filename

    + remove conditional `let`
    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    48d0220 View commit details
    Browse the repository at this point in the history
  9. Cells - replace inline JSX with static component instead

    - the inline jsx creates a new component every rerender, this does not
    kqualters-elastic authored and cee-chen committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    30efd08 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    aeb74d6 View commit details
    Browse the repository at this point in the history
  2. Memoize focusContext

    kqualters-elastic authored and cee-chen committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    9c7d2d6 View commit details
    Browse the repository at this point in the history
  3. Memoize useCellPopover further

    - more granular breakup of memoized vars to reduce rerenders and increase readability
    kqualters-elastic authored and cee-chen committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    1f00528 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7c18fe6 View commit details
    Browse the repository at this point in the history
  5. Add new useDeepEqual hook service + update style overrides from `re…

    …act-window` to use it
    kqualters-elastic authored and cee-chen committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    3696a75 View commit details
    Browse the repository at this point in the history
  6. Further memoize sorting utils

    - use new deep equal memoization hook to reduce rerenders on consumer-passed `sorting` and `sortingColumns`
    
    - separate out memoized `sortedRowMap` to reduce dependencies/rerenders further
    
    - rewrite `inMemoryRowIndices` more succinctly
    kqualters-elastic authored and cee-chen committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    0dbd5bb View commit details
    Browse the repository at this point in the history
  7. EuiDataGrid cell memoizations/cleanup

    - remove more inline jsx vars
    
    - move fn utilities to bottom of file + wrap in `memo()`
    
    - get rid of `cellContentProps` obj, just use props
    kqualters-elastic authored and cee-chen committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    b1ea642 View commit details
    Browse the repository at this point in the history
  8. Fix cellContext no longer triggering rerenders

    - performance changes worked I guess!
    cee-chen committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    6982d58 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2024

  1. Configuration menu
    Copy the full SHA
    2527be6 View commit details
    Browse the repository at this point in the history
  2. [PR feedback] Remove sorting prop from context

    - `sorting` is _only_ used by header cells, so it makes sense to waterfall it just to the header row instead of to all cells (which causes rerenders across every cell every time `sorting` from a consumer is referentially unstable)
    
    + rename sorting context to `sorted` to make the purpose of the context it clearer
    
    + reorder props list slightly (by usage etc)
    cee-chen committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    cd2dfb8 View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2024

  1. Memoize useDataGridColumnSorting

    + return null earlier (which requires creating new component)
    
    + convert args to obj for easier reuse
    
    + clean up/convert tests to RTL, reduce snapshots
    kqualters-elastic authored and cee-chen committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    8f01367 View commit details
    Browse the repository at this point in the history