diff --git a/apps/admin-ui/app/(drawer)/dashboard/complaints/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/complaints/index.tsx
index f070b32..8bd38cd 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/complaints/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/complaints/index.tsx
@@ -4,6 +4,7 @@ import { MaterialIcons } from "@expo/vector-icons";
import { useRouter } from "expo-router";
import { tw, ConfirmationDialog, MyText, MyFlatList, useMarkDataFetchers, ImageViewerURI } from "common-ui";
import { trpc } from "@/src/trpc-client";
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
export default function Complaints() {
const router = useRouter();
@@ -113,14 +114,11 @@ export default function Complaints() {
return (
item.id.toString()}
- initialNumToRender={10}
- maxToRenderPerBatch={10}
- windowSize={10}
- removeClippedSubviews
onEndReached={handleLoadMore}
onEndReachedThreshold={0.5}
renderItem={({ item }) => (
diff --git a/apps/admin-ui/app/(drawer)/dashboard/coupons/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/coupons/index.tsx
index 5d53799..8a314f7 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/coupons/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/coupons/index.tsx
@@ -7,6 +7,7 @@ import useManualRefresh from 'common-ui/hooks/useManualRefresh';
import { trpc } from '@/src/trpc-client';
import { useRouter } from 'expo-router';
import { TabView, SceneMap, TabBar } from 'react-native-tab-view';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
const CouponItem = ({ item, onDelete }: { item: any; onDelete: (id: number) => void }) => {
const router = useRouter();
@@ -341,6 +342,7 @@ const GeneralTab = () => {
/>
item.id.toString()}
renderItem={({ item }) => }
@@ -466,6 +468,7 @@ const ReservedTab = () => {
/>
item.id.toString()}
renderItem={({ item }) => }
diff --git a/apps/admin-ui/app/(drawer)/dashboard/customize-app/all-items-order.tsx b/apps/admin-ui/app/(drawer)/dashboard/customize-app/all-items-order.tsx
index 813c8db..0d91d95 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/customize-app/all-items-order.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/customize-app/all-items-order.tsx
@@ -31,6 +31,7 @@ const itemHeight = 80;
type Product = Pick
import type { DragOrderItemProps } from '@/types/drag-order-item';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
const ProductItem: React.FC> = ({
item,
@@ -295,6 +296,7 @@ export default function AllItemsOrder() {
item.id.toString()}
diff --git a/apps/admin-ui/app/(drawer)/dashboard/customize-app/popular-items.tsx b/apps/admin-ui/app/(drawer)/dashboard/customize-app/popular-items.tsx
index 562e8e7..528d4c6 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/customize-app/popular-items.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/customize-app/popular-items.tsx
@@ -25,6 +25,7 @@ import { trpc } from "../../../../src/trpc-client";
import MaterialIcons from "@expo/vector-icons/MaterialIcons";
import type { StoreProductCard } from '@packages/shared';
import type { DragOrderItemProps } from '@/types/drag-order-item';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
// Popular-items row = shared store card core with numeric (form) prices
type PopularProduct = Omit<
@@ -347,6 +348,7 @@ export default function CustomizePopularItems() {
(
void;
}
-const OrderItem: React.FC = ({
+const OrderItem = memo(({
item,
drag,
isActive,
@@ -114,7 +115,7 @@ const OrderItem: React.FC = ({
assignedUserName,
staffData,
setSelectedUserId,
-}) => {
+}: OrderItemProps) => {
const orderItem = item;
return (
@@ -261,7 +262,7 @@ const OrderItem: React.FC = ({
);
-};
+});
export default function DeliverySequences() {
const { slotId } = useLocalSearchParams();
@@ -435,6 +436,52 @@ export default function DeliverySequences() {
}
};
+ const handleToggleOrder = useCallback((id: number) => {
+ setSelectedOrderIds((prev) =>
+ prev.includes(id)
+ ? prev.filter((i) => i !== id)
+ : [...prev, id]
+ );
+ }, []);
+
+ const renderSequenceItem = useCallback(
+ ({ item, drag, isActive }: RenderItemParams) => (
+
+ ),
+ [
+ handleToggleOrder,
+ selectedOrderIds,
+ selectedUserId,
+ setSelectedOrder,
+ setShowOrderMenu,
+ setSelectedUserId,
+ staffData,
+ updateSequenceMutation.isPending,
+ ]
+ );
+
+ const keyExtractor = useCallback(
+ (item: OrderWithSequence) => item.sequenceId.toString(),
+ []
+ );
+
+ const listHeader = useMemo(
+ () => ,
+ [orders, selectedSlotId]
+ );
+
const handleSaveSequence = () => {
if (!selectedSlotId || selectedUserId === -1) return;
@@ -547,35 +594,14 @@ export default function DeliverySequences() {
) : (
(
- {
- setSelectedOrderIds((prev) =>
- prev.includes(id)
- ? prev.filter((i) => i !== id)
- : [...prev, id]
- );
- }}
- assignedUserName={selectedUserId === -2 ? item.assignedUserName : undefined}
- staffData={staffData}
- setSelectedUserId={setSelectedUserId}
- />
- )}
- keyExtractor={(item) => item.sequenceId.toString()}
+ renderItem={renderSequenceItem}
+ keyExtractor={keyExtractor}
onDragEnd={handleDragEnd}
showsVerticalScrollIndicator={false}
contentContainerStyle={tw`pb-8`}
- ListHeaderComponent={
-
- }
+ ListHeaderComponent={listHeader}
/>
)}
diff --git a/apps/admin-ui/app/(drawer)/dashboard/manage-orders/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/manage-orders/index.tsx
index 02c7855..a510489 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/manage-orders/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/manage-orders/index.tsx
@@ -7,6 +7,7 @@ import { useState, useCallback } from 'react';
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import { trpc } from '@/src/trpc-client';
import { useNavigationTarget } from 'common-ui/hooks/useNavigationTarget';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
export default function ManageOrders() {
const router = useRouter();
@@ -66,6 +67,7 @@ export default function ManageOrders() {
return (
(
diff --git a/apps/admin-ui/app/(drawer)/dashboard/manage-orders/orders/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/manage-orders/orders/index.tsx
index e622950..9cce5d5 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/manage-orders/orders/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/manage-orders/orders/index.tsx
@@ -1,4 +1,4 @@
-import React, { useState , useEffect } from 'react';
+import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { View, TouchableOpacity, Alert, TextInput, ActivityIndicator, Linking } from 'react-native';
import { AppContainer, MyText, tw, MyFlatList, BottomDialog, BottomDropdown, Checkbox, theme, MyTextInput } from 'common-ui';
import { trpc } from '@/src/trpc-client';
@@ -10,6 +10,7 @@ import CancelOrderDialog from '@/components/CancelOrderDialog';
import { OrderOptionsMenu } from '@/components/OrderOptionsMenu';
import * as Location from 'expo-location';
import type { AdminOrderListItem, AdminOrderListItemProduct } from '@packages/shared';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
const AdminNotesForm = ({ orderId, existingNotes, onClose, refetch }: { orderId: string; existingNotes?: string | null; onClose: () => void; refetch: () => void }) => {
const [notesText, setNotesText] = useState(existingNotes || '');
@@ -79,7 +80,7 @@ type OrderType = Omit<
discountAmount?: number;
};
-const OrderItem = ({ order, refetch }: { order: OrderType; refetch: () => void }) => {
+const OrderItem = memo(({ order, refetch }: { order: OrderType; refetch: () => void }) => {
const id = order.orderId;
const router = useRouter();
const [menuOpen, setMenuOpen] = useState(false);
@@ -484,7 +485,7 @@ const OrderItem = ({ order, refetch }: { order: OrderType; refetch: () => void }
>
);
- };
+ });
export default function Orders() {
const router = useRouter();
@@ -529,8 +530,37 @@ export default function Orders() {
}
);
- const orders = data?.pages.flatMap(page => page?.orders) || [];
-
+ const orders = useMemo(
+ () => (data?.pages.flatMap(page => page?.orders) ?? []).filter(Boolean) as OrderType[],
+ [data]
+ );
+
+ const keyExtractor = useCallback((item: OrderType) => item.orderId, []);
+ const renderOrder = useCallback(
+ ({ item }: { item: OrderType }) => ,
+ [refetch]
+ );
+ const handleEndReached = useCallback(() => {
+ if (hasNextPage && !isFetchingNextPage) {
+ fetchNextPage();
+ }
+ }, [fetchNextPage, hasNextPage, isFetchingNextPage]);
+ const handleRefresh = useCallback(() => {
+ refetch();
+ }, [refetch]);
+
+ const listFooter = useMemo(
+ () => (
+ isFetchingNextPage ? (
+
+
+ Loading more...
+
+ ) : null
+ ),
+ [isFetchingNextPage]
+ );
+
if (isLoading) {
return (
@@ -552,16 +582,13 @@ export default function Orders() {
return (
<>
item!.orderId}
- renderItem={({ item }) => item ? : null}
- onEndReached={() => {
- if (hasNextPage && !isFetchingNextPage) {
- fetchNextPage();
- }
- }}
+ keyExtractor={keyExtractor}
+ renderItem={renderOrder}
+ onEndReached={handleEndReached}
onEndReachedThreshold={0.5}
- onRefresh={() => refetch()}
+ onRefresh={handleRefresh}
ListHeaderComponent={
<>
@@ -615,14 +642,7 @@ export default function Orders() {
)}
>
}
- ListFooterComponent={
- isFetchingNextPage ? (
-
-
- Loading more...
-
- ) : null
- }
+ ListFooterComponent={listFooter}
/>
setFilterDialogOpen(false)}>
diff --git a/apps/admin-ui/app/(drawer)/dashboard/prices-overview/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/prices-overview/index.tsx
index eb395e0..ca4194e 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/prices-overview/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/prices-overview/index.tsx
@@ -20,6 +20,7 @@ import {
import { trpc } from "@/src/trpc-client";
import MaterialIcons from "@expo/vector-icons/MaterialIcons";
import { Entypo } from "@expo/vector-icons";
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
interface SkuItemProps {
sku: any;
@@ -351,6 +352,7 @@ export default function PricesOverview() {
) : (
(
}
keyExtractor={(item) => item.id.toString()}
diff --git a/apps/admin-ui/app/(drawer)/dashboard/product-tags/order.tsx b/apps/admin-ui/app/(drawer)/dashboard/product-tags/order.tsx
index 1f03deb..3bc0e05 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/product-tags/order.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/product-tags/order.tsx
@@ -21,6 +21,7 @@ import { useRouter } from 'expo-router';
import { trpc } from '../../../../src/trpc-client';
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import type { DragOrderItemProps } from '@/types/drag-order-item';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
const { width: screenWidth } = Dimensions.get('window');
const itemWidth = screenWidth - 48;
@@ -284,6 +285,7 @@ export default function TagOrders() {
item.id.toString()}
diff --git a/apps/admin-ui/app/(drawer)/dashboard/products/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/products/index.tsx
index 246665d..594f49b 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/products/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/products/index.tsx
@@ -8,6 +8,7 @@ import { MyText, tw, MyButton, useManualRefresh, SearchBar, useMarkDataFetchers,
import { trpc } from '@/src/trpc-client';
import VariantStockDialog from '@/src/components/VariantStockDialog';
import type { AdminSku } from '@packages/shared';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
type FilterType = 'all' | 'in-stock' | 'out-of-stock' | 'global';
@@ -282,6 +283,7 @@ export default function Products() {
return (
) : (
item.id.toString()}
renderItem={({ item }) => (
@@ -224,6 +226,7 @@ export default function RebalanceOrders() {
All Products
index.toString()}
renderItem={({ item }) => (
diff --git a/apps/admin-ui/app/(drawer)/dashboard/slots/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/slots/index.tsx
index 91bc5e6..3225529 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/slots/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/slots/index.tsx
@@ -6,6 +6,7 @@ import { trpc } from '@/src/trpc-client';
import { useRouter } from 'expo-router';
import dayjs from 'dayjs';
import { LinearGradient } from 'expo-linear-gradient';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
interface SlotItemProps {
item: any;
@@ -259,6 +260,7 @@ export default function Slots() {
return (
item.id.toString()}
renderItem={({ item }) => (
@@ -298,6 +300,7 @@ export default function Slots() {
All Products
index.toString()}
renderItem={({ item }) => (
diff --git a/apps/admin-ui/app/(drawer)/dashboard/stores/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/stores/index.tsx
index ffe24e4..a8e635d 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/stores/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/stores/index.tsx
@@ -8,6 +8,7 @@ import MyFlatList from 'common-ui/src/components/flat-list';
import { trpc } from '@/src/trpc-client';
import { LinearGradient } from 'expo-linear-gradient';
import Animated, { FadeInDown, FadeInUp } from 'react-native-reanimated';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
const { width: screenWidth } = Dimensions.get('window');
@@ -165,6 +166,7 @@ export default function Stores() {
return (
item.id.toString()}
renderItem={({ item, index }) => }
diff --git a/apps/admin-ui/app/(drawer)/dashboard/user-management/index.tsx b/apps/admin-ui/app/(drawer)/dashboard/user-management/index.tsx
index 65e1b43..7c1ef08 100644
--- a/apps/admin-ui/app/(drawer)/dashboard/user-management/index.tsx
+++ b/apps/admin-ui/app/(drawer)/dashboard/user-management/index.tsx
@@ -17,6 +17,7 @@ import {
} from 'common-ui';
import { trpc } from '@/src/trpc-client';
import { formatDistanceToNow } from 'date-fns';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
interface User {
id: number;
@@ -231,6 +232,7 @@ export default function UserManagement() {
{/* Users List */}
item.id.toString()}
diff --git a/apps/admin-ui/src/components/CouponForm.tsx b/apps/admin-ui/src/components/CouponForm.tsx
index 4b27766..e8ee45d 100644
--- a/apps/admin-ui/src/components/CouponForm.tsx
+++ b/apps/admin-ui/src/components/CouponForm.tsx
@@ -7,6 +7,7 @@ import { trpc } from '../trpc-client';
import ProductsSelector from '@/components/ProductsSelector';
import { CreateCouponPayload } from 'common-ui/shared-types';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
const USERS_PAGE_SIZE = 10;
@@ -452,6 +453,7 @@ export default function CouponForm({ onSubmit, isLoading, initialValues }: Coupo
onChangeText={setUserSearchQuery}
/>
item.id.toString()}
renderItem={({ item }) => (
diff --git a/apps/admin-ui/src/components/TagForm.tsx b/apps/admin-ui/src/components/TagForm.tsx
index 63a0f0e..1d5284e 100644
--- a/apps/admin-ui/src/components/TagForm.tsx
+++ b/apps/admin-ui/src/components/TagForm.tsx
@@ -10,6 +10,7 @@ import { Image } from 'expo-image';
import ProductsSelector from '@/components/ProductsSelector';
import { trpc } from '@/src/trpc-client';
import type { IdName } from '@packages/shared';
+import { ADMIN_LIST_VIRTUALIZATION } from '@/src/lib/list-virtualization';
type StoreOption = IdName;
@@ -269,6 +270,7 @@ const TagForm = forwardRef(({
)}
{selectedProducts.length > 0 ? (
item.productId.toString()}
diff --git a/apps/admin-ui/src/lib/list-virtualization.ts b/apps/admin-ui/src/lib/list-virtualization.ts
new file mode 100644
index 0000000..ec06a86
--- /dev/null
+++ b/apps/admin-ui/src/lib/list-virtualization.ts
@@ -0,0 +1,22 @@
+/**
+ * Shared FlatList windowing for the admin app.
+ *
+ * React Native's default windowSize (21) keeps roughly ten viewports of
+ * off-screen rows mounted. Admin lists are dense and can grow long, so three
+ * viewports is plenty and cuts the mounted (and re-rendered) row count sharply.
+ *
+ * initialNumToRender deliberately stays at RN's default (10): those cells are
+ * pinned for the scroll-to-top optimisation, and keeping the default means the
+ * first screen (and the test fixtures) render exactly as before. The win comes
+ * from windowSize and the smaller render batches.
+ *
+ * removeClippedSubviews is false on purpose: several lists contain modals,
+ * shadows or drag-and-drop cells that expect attached native views.
+ */
+export const ADMIN_LIST_VIRTUALIZATION = {
+ initialNumToRender: 10,
+ maxToRenderPerBatch: 6,
+ windowSize: 3,
+ updateCellsBatchingPeriod: 50,
+ removeClippedSubviews: false,
+} as const
diff --git a/change-log.txt b/change-log.txt
index 6e41b33..1e54791 100644
--- a/change-log.txt
+++ b/change-log.txt
@@ -386,3 +386,53 @@ forever, growing worse as Show More appended rows.
~ mainListIds reads the row items from sections[0].data (kind === 'row').
~ Mocks home-list-tuning with initialNumToRender 20 so interaction assertions
have product rows mounted (jsdom never scrolls a virtualized list).
+
+[2026-11-01 19:57:06 IST] admin-ui manage-orders: virtualize the order lists and stop re-rendering every mounted row.
+
+--- apps/admin-ui/app/(drawer)/dashboard/manage-orders/orders/index.tsx
+~ OrderItem wrapped in React.memo; orders pages flattened in a useMemo;
+ keyExtractor/renderItem/onEndReached/onRefresh are stable callbacks and the
+ footer is memoized. With the inline props, every filter-dialog state change
+ re-rendered every mounted row (each with six dialog elements).
+~ FlatList window: initialNumToRender 6, maxToRenderPerBatch 6, windowSize 5,
+ updateCellsBatchingPeriod 50, removeClippedSubviews false (rows carry
+ modals/shadows; windowing already unmounts them).
+--- apps/admin-ui/app/(drawer)/dashboard/manage-orders/delivery-sequences/index.tsx
+~ OrderItem wrapped in React.memo; stable renderItem/keyExtractor and a stable
+ onToggleOrder (the inline callback previously defeated memoization);
+ ListHeaderComponent memoized.
+~ DraggableFlatList window: initialNumToRender 6, maxToRenderPerBatch 6,
+ windowSize 3 (rows are shorter), updateCellsBatchingPeriod 50,
+ removeClippedSubviews false (drag/measure needs the cells attached).
+- Hub (2 items) and order-details (ScrollView, no FlatList) left untouched.
+- admin-web uses its own non-virtualized MyFlatList (plain map); the RN
+ virtualization props do not exist there.
+
+[2026-11-01 19:59:28 IST] admin-ui: apply the shared FlatList virtualization preset to every list page.
+
+Every MyFlatList / FlatList / DraggableFlatList in apps/admin-ui now spreads
+ADMIN_LIST_VIRTUALIZATION: initialNumToRender 10 (RN default, so initial test
+fixtures stay mounted), maxToRenderPerBatch 6, windowSize 3, updateCellsBatching
+Period 50, removeClippedSubviews false. RN's default windowSize is 21, so each
+list keeps roughly a seventh of the off-screen rows it used to.
+
+--- apps/admin-ui/src/lib/list-virtualization.ts (new)
++ one shared preset object.
+~ app/(drawer)/dashboard/manage-orders/orders/index.tsx
+~ app/(drawer)/dashboard/manage-orders/delivery-sequences/index.tsx
+~ app/(drawer)/dashboard/manage-orders/index.tsx
+~ app/(drawer)/dashboard/complaints/index.tsx
+~ app/(drawer)/dashboard/coupons/index.tsx (two lists)
+~ app/(drawer)/dashboard/product-tags/index.tsx
+~ app/(drawer)/dashboard/products/index.tsx
+~ app/(drawer)/dashboard/rebalance-orders/index.tsx (two lists)
+~ app/(drawer)/dashboard/slots/index.tsx (two lists)
+~ app/(drawer)/dashboard/stores/index.tsx
+~ app/(drawer)/dashboard/user-management/index.tsx
+~ app/(drawer)/dashboard/prices-overview/index.tsx
+~ app/(drawer)/dashboard/customize-app/all-items-order.tsx
+~ app/(drawer)/dashboard/customize-app/popular-items.tsx
+~ app/(drawer)/dashboard/product-tags/order.tsx
+~ src/components/CouponForm.tsx
+~ src/components/TagForm.tsx
+- admin-web uses the non-virtualized web MyFlatList; unchanged.