Skip to content

[HOLD for payment 2023-10-02] Memoize expensive calls in ReportActionsList renderItem #27972

Description

@mountiny

Problem

Some of the operations we do in ReportActionsList renderItem are pretty expensive since this function is executed for every items in the render window every time the render window changes. To improve performance of FlatList scrolling we need to move any expensive computation inside a memoized component. This way when FlatList re-renders to display new items but the data did not change only the new rendered items will need to render.

We were already memoizing ReportActionItem, but renderItem still contains some expensive calls, specifically isConsecutiveActionMadeByPreviousActor which has to do some date comparisons. I moved those to a new component ReportActionsListItemRenderer which will prevent any re-renders coming from from FlatList for items that were already rendered. This reduces the number of calls to isConsecutiveActionMadeByPreviousActor from the number of currently rendered item (~100 depending on the FlatList window size) to just the new items being added (usually 10 since this is the batch size).

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Task

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions