Skip to content

A local-first personal finance app

Add virtualizer to mobile rules list (#5899)

Matiss Janis Aboltins3715f16888e3
diff --git a/packages/desktop-client/src/components/mobile/rules/RulesList.tsx b/packages/desktop-client/src/components/mobile/rules/RulesList.tsx
index 5612b03f7d..c9d496530b 100644
--- a/packages/desktop-client/src/components/mobile/rules/RulesList.tsx
+++ b/packages/desktop-client/src/components/mobile/rules/RulesList.tsx
@@ -1,4 +1,4 @@
-import { GridList } from 'react-aria-components';
+import { Virtualizer, GridList, ListLayout } from 'react-aria-components';
import { useTranslation } from 'react-i18next';
import { AnimatedLoading } from '@actual-app/components/icons/AnimatedLoading';
@@ -66,25 +66,31 @@ export function RulesList({
}
return (
- <View style={{ flex: 1 }}>
- <GridList
- aria-label={t('Rules')}
- aria-busy={isLoading || undefined}
- items={rules}
- style={{
- flex: 1,
- paddingBottom: MOBILE_NAV_HEIGHT,
- overflow: 'auto',
+ <View style={{ flex: 1, overflow: 'auto' }}>
+ <Virtualizer
+ layout={ListLayout}
+ layoutOptions={{
+ estimatedRowHeight: 140,
+ padding: 0,
}}
>
- {rule => (
- <RulesListItem
- value={rule}
- onAction={() => onRulePress(rule)}
- onDelete={() => onRuleDelete(rule)}
- />
- )}
- </GridList>
+ <GridList
+ aria-label={t('Rules')}
+ aria-busy={isLoading || undefined}
+ items={rules}
+ style={{
+ paddingBottom: MOBILE_NAV_HEIGHT,
+ }}
+ >
+ {rule => (
+ <RulesListItem
+ value={rule}
+ onAction={() => onRulePress(rule)}
+ onDelete={() => onRuleDelete(rule)}
+ />
+ )}
+ </GridList>
+ </Virtualizer>
{isLoading && (
<View
style={{
diff --git a/upcoming-release-notes/5899.md b/upcoming-release-notes/5899.md
new file mode 100644
index 0000000000..eecf687c93
--- /dev/null
+++ b/upcoming-release-notes/5899.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [MatissJanis]
+---
+
+Mobile rules: add virtualizer to the list for improved performance