freshyo/change-log.txt
2026-11-02 20:27:44 +05:30

528 lines
30 KiB
Text

[2026-10-29 22:54:34 IST] Admin app: open the order from an order-placed push, including cold start.
--- apps/admin-ui/services/notif-service/pending-order.ts (new)
+ Module-level pending order id: setPendingOrderId / takePendingOrderId / clearPendingOrderId.
--- apps/admin-ui/services/notif-service/notif-context.tsx
~ Extract openFromNotification(response): numeric-validates data.orderId, dedupes by
request.identifier, pushes order details when signed in, stashes the id when signed out.
~ Call it from the response listener AND from Notifications.getLastNotificationResponseAsync()
(terminated-app tap), then clearLastNotificationResponseAsync().
~ Wait for StaffAuthProvider hydration (isLoading === false) before handling the launch response.
--- apps/admin-ui/components/context/staff-auth-context.tsx
~ On login success, route to a pending order notification target instead of always the dashboard.
--- apps/admin-ui/tests/mocks/expo-notifications-mock.ts
+ clearLastNotificationResponseAsync mock; __setLastResponse() to seed the cold-start response.
--- apps/admin-ui/tests/app/root-layout.test.tsx
+ AROOT-06 cold-start tap, AROOT-07 duplicate response opened once, AROOT-08 signed-out deferral.
--- apps/admin-ui/tests/pages/login.test.tsx
+ ALOGIN-15 pending order target wins over the dashboard after login.
--- apps/admin-ui/JEST-TEST-CASES.md
+ Catalogue rows for AROOT-06..08 and ALOGIN-15.
[2026-10-29 22:57:48 IST] Admin push notifications for order cancellation and new complaints.
--- apps/backend/src/lib/admin-notif.ts
~ notifyAllAdmins payload gains optional complaintId; forwarded in jobData.
--- apps/backend/src/lib/notif-job.ts
~ sendAdminNotification accepts complaintId and includes it in the push data.
--- apps/backend/src/lib/queue-consumer.ts
~ forwards jobData.complaintId (null fallback) to sendAdminNotification.
--- apps/backend/src/lib/post-order-handler.ts
~ handleOrderCancelled pushes "Order Cancelled" to every admin device with data.orderId.
--- packages/db_helper_sqlite/src/user-apis/complaint.ts
~ createComplaint returns the inserted complaint id (was void).
--- apps/backend/src/trpc/apis/user-apis/apis/complaint.ts
~ complaint.raise pushes "New Complaint" to admin devices with data.complaintId;
notification failures are logged and never fail the complaint.
--- apps/admin-ui/services/notif-service/pending-navigation.ts (renames pending-order.ts)
~ Holds a pending href instead of an order id, so a signed-out tap on either
notification type resumes after login.
--- apps/admin-ui/services/notif-service/notif-context.tsx
~ Routes data.complaintId to the complaints list (orderId still wins).
--- apps/admin-ui/components/context/staff-auth-context.tsx
~ login consumes the pending href.
--- tests
~ queue-consumer expectation gains complaintId; admin-ui root-layout/login tests
updated for the href-based pending target; AROOT-09 complaint tap added.
[2026-10-29 23:02:23 IST] Scope admin order/complaint push notifications to the event's region.
--- packages/db_helper_sqlite/src/admin-apis/staff-user.ts
+ getStaffNotifTokensForRegion(regionId): staff_notif_creds inner-joined to
staff_users where staff_users.region_id = regionId.
--- packages/db_helper_sqlite/index.ts
+ export the new helper.
--- packages/db_helper_sqlite/src/user-apis/order.ts
~ OrderWithFullData gains regionId (already selected at runtime).
--- packages/db_helper_sqlite/src/user-apis/complaint.ts
~ createComplaint returns { id, regionId } instead of a bare id.
--- apps/backend/src/lib/admin-notif.ts
+ notifyRegionAdmins(regionId, payload) — refuses null region, otherwise batches
the region's tokens. notifyAllAdmins kept for manual broadcasts only.
--- apps/backend/src/lib/post-order-handler.ts
~ Order placed and order cancelled use notifyRegionAdmins(order.regionId, ...).
--- apps/backend/src/trpc/apis/user-apis/apis/complaint.ts
~ complaint.raise uses notifyRegionAdmins(complaint.regionId, ...).
--- apps/backend/tests/unit/admin-notif.test.ts
~ Rewritten for region scoping + manual broadcast; asserts null region is a no-op.
[2026-11-01 12:32:24 IST] user-ui home: match the All Available Products grid spacing to the tag grid.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ staticStyles.columnWrapper.paddingHorizontal 16 -> 28. Cards keep
heroItemWidth, so the horizontal gap becomes 8px, identical to the tag grid
(mx-4 + px-3 = 28px inset, same 8px gaps).
~ All Available Products heading row px-1 -> px-3 so the title sits on the same
28px gutter as the rows.
No data, paging, or card changes.
[2026-11-01 12:34:02 IST] user-ui home: give the catalog grid the extra space as card width.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ Reverts the 28px row gutter: columnWrapper.paddingHorizontal back to 16 so the
grid keeps the page's 16px margin (and the heading returns to px-1).
+ catalogItemWidth = (screenWidth - 48) / 3; ProductItem (catalog rows only)
uses it instead of heroItemWidth, so three cards fill the row with 8px gaps.
Tag grid keeps heroItemWidth inside its 28px inset card.
[2026-11-01 12:37:54 IST] user-ui Offers/Combos: same compact 3-up grid as the home catalog.
--- apps/user-ui/app/(drawer)/(tabs)/order-again/index.tsx
~ heroItemWidth -> catalogItemWidth = (screenWidth - 48) / 3.
~ Grid gap-5 (20px) -> gap-2 (8px); px-4 page margin unchanged.
Three cards now fill the row, matching the All Available Products grid.
Web offers page already uses a 12px grid gap (gap-3), so no web change.
[2026-11-01 12:51:23 IST] Flash delivery: tag tabs instead of the store drawer, 3-up hero grid.
--- apps/user-ui/components/ProductCard.tsx
+ cartType?: 'regular' | 'flash' (default regular). Flash reads/writes the flash
cart, prices flashPrice ?? price, adds with slotId 0 and the 1hr alert, and
skips scheduled-slot out-of-stock/delivery badges. Regular call sites unchanged.
--- apps/user-ui/components/SlotSpecificView.tsx
+ FlashTagStrip: horizontal, fixed strip copied from home's TagTabStrip mechanics.
~ SlotLayout: isForFlashDelivery renders selector + strip + <Slot/>; the
scheduled view keeps its Drawer untouched.
~ FlashDeliveryProducts: tags from useAllProducts (first tag default), filter by
tag.productIds then search, numColumns 3, width (sw-48)/3, columnGap 8,
rowGap 12, ProductCard hero cards. Store filtering/loading gates removed.
--- apps/user-ui/app/(drawer)/(tabs)/flash-delivery/(products)/index.tsx
--- apps/user-ui/app/(drawer)/(tabs)/flash-delivery/(products)/_layout.tsx
~ storeId param no longer read or written; route shape unchanged.
--- apps/web-ui/src/routes/flash.tsx
~ Store tabs -> tag tabs (same order, first default); store filtering removed;
cart storeId still taken from the product.
--- tests
~ flash-products store cases rewritten for tags; slot-view flash asserts no
drawer; JEST-TEST-CASES rows updated.
[2026-11-01 12:56:02 IST] Flash delivery: page the tag feed 9 at a time with Show More.
--- apps/user-ui/components/SlotSpecificView.tsx
+ FLASH_PAGE_SIZE = 9; visibleCount state, reset on tag/search change; grid renders
the first 9, footer Show More adds 9 (home's pattern). testID flash-products-show-more.
--- apps/web-ui/src/routes/flash.tsx
~ Same 9-at-a-time paging with a Show More button; reset on tag change.
--- apps/user-ui/tests/pages/flash-products.test.tsx
+ FLASH-19: nine products render, Show More reveals the rest.
--- apps/user-ui/JEST-TEST-CASES.md
+ FLASH-19 row.
[2026-11-01 12:59:05 IST] Flash delivery: scroll-away tabs + a "Shop by Store" tab section.
--- apps/user-ui/components/SlotSpecificView.tsx
~ FlashTagStrip generalised to FlashTabStrip (items + testID prefix); reused for
tags and stores.
~ FlashDeliveryProducts becomes a ScrollView: search, tag strip, tag grid (9 +
Show More), then "Shop by Store" heading, store strip, store grid (9 + Show
More). Both strips scroll with the page; paging resets per section on
tab/search change. Search filters both grids. Every store gets a tab.
--- apps/web-ui/src/routes/flash.tsx
~ Same two sections, store tabs below the tag grid, independent 9-item paging.
--- tests
~ Product assertions scoped to the tag grid; new store-section cases.
[2026-11-01 14:06:51 IST] Flash delivery: the pull-to-refresh spinner no longer reports background fetches.
Diagnosed with a throwaway cache-subscription test (25s, real timers): the flash
screen itself starts no background fetches (only the 7 initial ones), and the
catalogue URL is built from assetsDomain/apiCacheKey/region/version — stable, so
the products query key does not churn. There is no 10s timer anywhere in
user-ui. What is wrong is the wiring: `refreshing` was bound to
`productsQuery.isFetching`, so *any* fetch (mount-after-stale, invalidation,
version bump, pull) drove the pull-to-refresh control, and the control element
was rebuilt on every render (re-attaching the platform control).
--- apps/user-ui/components/SlotSpecificView.tsx
~ FlashDeliveryProducts: `isRefreshing` local state + handleRefresh
(refetch products + stores, clear in finally), RefreshControl element
memoised. Mirrors home's handleRefresh. Background fetches are invisible.
--- apps/user-ui/src/hooks/useHideTabNav.ts
~ Focus callback memoised (was recreated every render, so useFocusEffect
unsubscribed/resubscribed per render and wrote false->true into the store,
flickering the tab bar on every render of every screen using it).
--- apps/user-ui/src/store/appStore.ts
~ setHideTabsNavKey no longer allocates when the key already has that value,
so it cannot notify subscribers spuriously.
--- tests
+ FLASH-24: a background refetch leaves the spinner idle.
+ FLASH-25: a pull keeps the spinner up until the refresh settles.
+ HIDE-04: re-render does not rewrite the store.
+ STORE-20: same-value write keeps the map identity.
[2026-11-01 14:24:07 IST] user-ui: arm64-only Android profile for personal device builds.
--- apps/user-ui/eas.json
+ "shafi-dev-arm64": internal distribution, channel shafi-dev, buildType apk,
gradleCommand ":app:assembleRelease -PreactNativeArchitectures=arm64-v8a".
Same JS/OTA channel as shafi-dev; the APK simply carries only arm64-v8a native
libs instead of all four ABIs (that is most of the 80 MB universal APK).
~ shafi-dev left untouched (universal APK for emulators / 32-bit testers).
[2026-11-01 14:31:37 IST] user-ui: shafi-dev now builds arm64-only + R8 (was universal APK).
Measured on the device (Play install, v1.2.0): base.apk 38.4 MB (dex 29.6 MB,
assets 3.9, res 2.7) + split arm64 libs 19.0 MB + density/langs 0.4 => 57.8 MB
installed. The local universal APK carries the same bytes plus three unused ABI
sets (x86, x86_64, armeabi-v7a), which is the 80 MB.
--- apps/user-ui/eas.json
~ shafi-dev: explicit buildType apk; gradleCommand
":app:assembleRelease -PreactNativeArchitectures=arm64-v8a
-Pandroid.enableProguardInReleaseBuilds=true".
-PreactNativeArchitectures drops the three unused ABIs, and the ProGuard
property turns on R8 + resource shrinking for this profile only (the template
reads it via findProperty, so production is untouched).
- shafi-dev-arm64 removed: redundant now that shafi-dev is arm64-only.
[2026-11-01 14:53:35 IST] Home: catalogue memo is the single source for products, tags and products-by-tag.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ Removed `products = productsData?.products || []`, `dashboardTags =
productsData?.tags || []` and the separate `productsByTagId` memo. One memo
now returns { dashboardTags, products, productsByTagId } and all three are
read from it.
~ productById Map hoisted out of the per-tag loop (it was rebuilt once per tag).
~ Duplicate ids in tag.productIds are skipped (first occurrence wins), so a
repeated id renders one card instead of two.
~ displayedProducts effect deps use the memo's `products`.
--- apps/user-ui/hooks/useProductSlotIdentifier.ts
~ getQuickestSlot wrapped in useCallback with [slots, productSlotsMap]. It was
a new function every render, which made the catalogue memo recompute on every
render (and defeated its useMemo).
--- apps/web-ui/src/routes/home.index.tsx
~ Same restructure: one memo returns { dashboardTags, allProducts,
productsByTagId }, dedupe + hoisted productById, and the dead `extra` branch
removed (its filter can never match: orderedIds is built from productIds).
--- apps/user-ui/tests/pages/home.test.tsx
~ HOME-16 rewritten: duplicate ids in a tag now render once (was pinning the
bug).
--- apps/user-ui/JEST-TEST-CASES.md
~ HOME-16 catalogue row updated.
[2026-11-01 15:10:50 IST] Home tag selection/expansion moved to a zustand store so a tap stops re-rendering the whole page.
Selecting a tag used to set Dashboard state, which re-rendered Dashboard, rebuilt
ListHeader and rebuilt the SectionList `sections` literal, re-rendering every
visible main-list ProductCard as well. The selection now lives outside React
state; only the tab strip and the active tag scene subscribe.
--- apps/user-ui/src/store/homeTagStore.ts (new)
+ selectedTagId + expandedByTagId + selectTag/expandTag/resetHomeTags.
+ Writes are no-ops when unchanged (same guard as appStore.setHideTabsNavKey)
so re-selecting the active tag does not wake subscribers.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ Removed Dashboard's selectedTagId/expandedByTagId state, activeTagId,
handleToggleExpand and the dead pageTint (both styles hardcoded #FFFFFF, so
getTagColor/TAG_COLORS had no visible effect).
~ TagTabStrip and TagScene subscribe to useHomeTagStore directly; their
activeTagId/onSelectTag/expandedByTagId/onToggleExpand props are gone.
~ ListHeader no longer receives or forwards selection props.
~ listHeader memo deps drop activeTagId/expandedByTagId/handleToggleExpand, so
Dashboard no longer produces a new header element on a tag tap.
--- apps/user-ui/src/lib/region-switch.ts
+ resetHomeTags() on region switch: tag ids are region-scoped.
--- apps/user-ui/tests/helpers/reset.ts
+ reset the home tag store between cases.
--- apps/user-ui/tests/lib/stores.test.ts
+ STORE-21: selecting the active tag again keeps store identity.
+ STORE-22: resetHomeTags clears selection and expansion.
--- apps/user-ui/JEST-TEST-CASES.md
~ rows for STORE-21/22.
--- apps/web-ui/src/lib/stores/home-tag-store.ts (new)
+ Same store, mirrored.
--- apps/web-ui/src/routes/home.index.tsx
~ selection/expansion read from the store (the web page is one component, so it
still subscribes; behaviour matches user-ui).
--- apps/web-ui/src/lib/region-switch.ts
+ resetHomeTags() on region switch.
[2026-11-01 17:53:16 IST] user-ui: ProductCard images move from RN Image (Fresco) to expo-image.
Diagnosed from the device onError payload:
"Pool hard cap violation? Hard cap = 301989888 Used size = 301156264 Free
size = 0 Request size = 4259840" — Fresco's bitmap pool (288 MiB) was full, so
valid images failed to decode. Live catalogue check: 148/149 image URLs return
200 image/*; the one 404 is product 84's ref missing the product-images/ prefix.
Source images are 1024-1600px, i.e. 4-10 MB decoded at source vs ~0.35 MB at
card size.
--- apps/user-ui/components/ProductCard.tsx
~ <RnImage> replaced with expo-image <Image> (already imported, used by every
other image surface in the app): contentFit="cover", cachePolicy="memory-disk",
recyclingKey=item.id, transition={0}. Glide downsamples to the view size and
bounds its caches instead of holding full-size bitmaps in Fresco's pool.
~ resizeMode moved out of the style object into contentFit (style resizeMode is
not a valid RN style).
~ onError now surfaces event.error (was discarded, always "Image failed to
load"). Remove the now-unused `Image as RnImage` import.
--- apps/user-ui/tests/pages/home.test.tsx
~ HOME-38 fires the error on the expo-image mock (testID "expo-image") instead
of an RN Image instance.
[2026-11-01 18:07:16 IST] product-images: generated 1000px copies of the 147 oversized catalogue images (nothing uploaded).
--- product-images/resized/ (new, untracked)
+ one resized copy per row of needs-edit.csv; max side 1000, aspect preserved,
JPEG re-encoded at quality 70, PNG kept as PNG. Originals untouched.
--- product-images/resized-report.csv (new, untracked)
+ per file: old/new dimensions, old/new bytes, old/new decoded MB, delta.
- R2 bucket, products.json and DB were not modified.
[2026-11-01 18:26:30 IST] product-images: 800px pass generated and uploaded over the live keys (prod bucket).
--- product-images/resized-800/ (new, untracked)
+ every referenced catalogue image with max side > 800 resized to 800px
(JPEG q70, PNG kept as PNG). Originals left untouched in product-images/.
--- product-images/resized-800-report.csv (new, untracked)
+ per file: old/new dimensions, bytes and decoded MB.
--- R2 (bucket meatfarmer, prefix product-images/)
~ the same keys were overwritten with the 800px files; Content-Type preserved
per output format. Cloudflare cache purged for every replaced URL.
- No DB rows, products.json or version numbers changed.
[2026-11-01 18:37:42 IST] products.json: append a static cache-busting query to image URLs.
Client image caches are keyed by URL and the R2 object keys never change, so
replaced files were invisible to phones that had cached the old bytes. The
generated catalogue now appends ?random=1 to every product image URL and tag
imageUrl. Static by design: a per-request value would defeat caching.
--- apps/backend/src/lib/product-image-cache.ts (new)
+ PRODUCT_IMAGE_CACHE_BUST = 'random=1', withImageCacheBust(url) (handles a URL
that already has a query) and applyImageCacheBust(catalogue), which rewrites
product images and tag imageUrl only.
--- apps/backend/src/lib/cloud_cache.ts
~ createProductsFileInternal applies applyImageCacheBust before serialising, so
only the published products.json carries the query; the admin summary endpoint
and the test snapshot controller keep raw URLs.
--- apps/backend/tests/unit/product-image-cache.test.ts (new)
+ unit coverage for plain URLs, URLs with a query, empty values, the
product/tag mapping and input immutability.
--- docs/jobs-to-be-added.txt
+ job to roll the same asset version out to the remaining image surfaces.
[2026-11-01 19:03:33 IST] user-ui: enforce a 3-day TTL on the expo-image disk cache.
expo-image has no per-entry TTL (cachePolicy is only none/disk/memory/memory-disk;
the underlying Glide/SDWebImage caches are LRU, no expiry). It does expose
Image.clearDiskCache(), so the cache is cleared when the stored timestamp is
older than 3 days, checked on mount and whenever the app returns to the
foreground. Results in a maximum age of 3 days for any cached image.
--- apps/user-ui/src/lib/image-cache-ttl.ts (new)
+ IMAGE_CACHE_TTL_MS (3 days), IMAGE_CACHE_CLEARED_AT_KEY and
shouldClearImageCache(lastClearedAt, now) (null/invalid/future timestamps
clear).
--- apps/user-ui/src/lib/image-cache-meta.ts (new)
+ timestamp persisted in a plain file under expo-file-system's documentDirectory
(expo-file-system is a dependency of expo). No SecureStore / StorageService.
--- apps/user-ui/src/components/ImageCacheTtl.tsx (new)
+ one-shot guard, reads the file timestamp, calls Image.clearDiskCache() only
when expired, writes the new timestamp when the clear reports success. Errors
never block startup.
--- apps/user-ui/app/_layout.tsx
+ mount <ImageCacheTtl /> inside CentralStoreInitializer.
--- apps/user-ui/tests/mocks/native/common.tsx + tests/jest.config.js
+ expo-image mock gains clearDiskCache/clearMemoryCache/prefetch jest.fn
statics; expo-file-system is mapped to the same shim.
--- apps/user-ui/tests/lib/image-cache-ttl.test.tsx (new)
+ IMGCACHE-01..07: helper boundaries, component clear/skip and failed-clear.
--- apps/user-ui/tests/lib/image-cache-meta.test.ts (new)
+ IMGCACHE-08..10: missing/corrupt file and the write path.
--- apps/user-ui/JEST-TEST-CASES.md
+ rows for IMGCACHE-01..10.
[2026-11-01 19:19:30 IST] home: split the monolithic list header into separate virtualized items and tighten the render window.
The whole top block (glimpse + tag strip + tag grid + stores + slots + "All
Available Products" title) was a single SectionList item, and the first
`initialNumToRender` items are pinned by VirtualizedList. With
initialNumToRender=10 and windowSize=5, the header plus ~27 cards stayed mounted
forever, growing worse as Show More appended rows.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ Removed the ListHeader component/wrapper. The list data is now a list of
typed items: glimpse, tagStrip, tagScene, stores, slots, allProductsTitle,
empty and row (3 products). Each renders independently, so the top sections
unmount as they scroll out of the window.
~ Per-item white/px-4 wrappers replace the old rounded-t-3xl wrapper (page
background is white, so the rounded edge was not visible).
~ Extracted HomeGlimpse, TagSceneBlock, StoresSection, SlotsSection and
AllProductsTitle (all memoized); SlotsSection keeps its own renderSlotItem.
~ sections, keyExtractor, renderItem, renderSectionHeader and the footer are
memoized/callback-stable so unrelated Dashboard renders no longer rebuild
the list props.
--- apps/user-ui/src/lib/home-list-tuning.ts (new)
+ HOME_INITIAL_RENDER_COUNT=2, HOME_WINDOW_SIZE=3, HOME_MAX_RENDER_BATCH=6.
VirtualizedList pins the first initialNumToRender cells forever, so it must
stay small for the split top sections to unmount.
~ Virtualization props now read those constants (was windowSize 5,
initialNumToRender 10, maxToRenderPerBatch 10). removeClippedSubviews stays
off (nested horizontal scrollers).
- ProductCard's 5s interval left untouched, as requested.
--- apps/user-ui/tests/pages/home.test.tsx
~ 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.
[2026-11-02 08:01:30 IST] flash-delivery: move tab/search selection out of the page component so a tab tap stops re-rendering the whole screen.
The page held selectedTagId, selectedStoreId, searchQuery and both visible
counts in FlashDeliveryProducts. A tap re-rendered the page, both strips, both
grids and every ProductCard (ProductCard is not memoized and renderProduct
built a new onPress per render). Tabs also rendered twice per tap: the
visible-count reset lived in a useEffect that ran after paint.
--- apps/user-ui/src/store/flashTabStore.ts (new)
+ selectedTagId / selectedStoreId / searchQuery plus selectTag, selectStore,
setSearchQuery, resetFlashTabs. select* are same-value no-ops (same guard as
homeTagStore) so re-tapping the active tab does not wake subscribers.
--- apps/web-ui/src/lib/stores/flash-tab-store.ts (new)
+ mirror of the native store (same shape, same reset).
--- apps/user-ui/components/SlotSpecificView.tsx
~ FlashDeliveryProducts now only derives the catalog: one memo builds
tagTabs, storeTabs, per-tag rows (productsByTagId) and per-store rows
(productsByStoreId), plus the stable tab item arrays.
~ New FlashSearchBar subscribes to the store, so typing no longer re-renders
the page, the strips or the other grid.
~ New FlashTagStrip / FlashStoreStrip wrappers subscribe to the store and
derive activeId themselves; FlashTabStrip keeps its memo and now receives
stable items/onSelect, so it no longer rebuilds on every keystroke.
~ New FlashTagSection / FlashStoreSection (memo) subscribe to the store, so a
tag tap re-renders only the tag grid and a store tap only the store section.
~ New FlashProductGrid owns visibleCount; the grid is keyed by active id so a
tab switch resets the page size in one render (no effect, no double paint).
A search change resets it during render with the same pattern.
~ New FlashProductItem (memo) derives its onPress from item.id; the page's
onProductPress handler is a useCallback.
--- apps/user-ui/components/ProductCard.tsx
~ default export wrapped in React.memo; parents pass stable item/onPress.
--- apps/user-ui/app/(drawer)/(tabs)/flash-delivery/(products)/index.tsx
~ handleProductPress wrapped in useCallback (it was recreated every render,
which defeated memoisation on every card).
--- apps/user-ui/src/lib/region-switch.ts, apps/web-ui/src/lib/region-switch.ts
~ resetFlashTabs() on region switch: tag/store ids are region-scoped.
--- apps/user-ui/tests/helpers/reset.ts
~ reset the flash tab store between cases.
--- apps/web-ui/src/routes/flash.tsx
~ same restructure: store-backed selection/search, memoized
FlashTagStrip / FlashStoreStrip / FlashProductGrid / FlashProductItem,
CompactProductCard wrapped in memo with a stable handleAddToCart.
- Flash grids are still plain maps inside the page ScrollView (no FlatList);
virtualization left for a follow-up since the page stacks two sections.
--- apps/user-ui/tests/lib/stores.test.ts
+ STORE-23: re-selecting the active flash tag/store keeps the store identity.
+ STORE-24: resetFlashTabs drops both selections and the search box.
+ STORE-25: an unchanged flash search query keeps the store identity.
--- apps/user-ui/JEST-TEST-CASES.md
~ catalogue rows STORE-23..25 added.
[2026-11-02 20:03:22 IST] home: fix the true-positive React Doctor findings (report in apps/user-ui/REACT-DOCTOR-HOME.md).
--- apps/user-ui/hooks/useHomeCatalog.ts (new)
+ One hook owns the catalogue derivation that used to sit inside Dashboard:
useAllProducts + slot helpers, the products/productsByTagId memo, the
out-of-stock sort (still an effect so the reset keeps its old timing), the
displayed count and the Show More page size (21).
+ The sort effect now lists getQuickestSlot and isSlotsLoaded in its deps
(react-doctor/exhaustive-deps, index.tsx:587). Safe: getQuickestSlot is
useCallback-memoized on [slots, productSlotsMap] and the effect writes only
displayed count state, so it cannot self-trigger.
+ hasMore is derived (visibleCount < displayedProducts.length) instead of state,
and showMore is a pure updater, removing the nested setHasMore() call inside
setVisibleCount (react-doctor/no-impure-state-updater,
no-side-effect-in-state-updater-function).
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ Dashboard calls useHomeCatalog(); the catalogue memo, sort effect, both
catalogue states and handleShowMore moved out (~75 lines). Behaviour, testIDs
and the HOME_* virtualization props unchanged.
~ New SectionHeading component shared by SlotsSection and AllProductsTitle,
which repeated the same 9-line heading (duplicate-jsx-subtree).
--- apps/user-ui/app/(drawer)/(tabs)/home/search-results/index.tsx
~ New memoized SearchResultItem owns its onPress (derived from item.id) and the
screen passes a stable handleProductPress, so the inline handler no longer
defeats ProductCard's memo (rn-list-callback-per-row).
- Left as-is, with reasons in the report: the tag strip is a ScrollView on
purpose (rn-no-scrollview-mapped-list), totalAmount is a string from
useLocalSearchParams (rn-no-falsy-and-render), root lock files need a
package-manager decision (expo-lockfile).
~ ShowMoreFooter is now a memo component rendered as ListFooterComponent,
instead of a useMemo built before the loading/error early returns
(rerender-memo-before-early-return).
~ search-results: allProducts is memoised on productsData so the Fuse memo has a
stable dependency (react-hooks/exhaustive-deps).
- Re-scan after the fixes: 11 -> 3 findings. The 3 left are the documented false
positives (tag-strip ScrollView, string totalAmount) and the root lockfile
decision.