freshyo/change-log.txt
2026-11-15 23:53:14 +05:30

1420 lines
76 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.
[2026-11-02 20:32:28 IST] user-ui tests: stop jest-expo's expo-file-system mock from replacing the shared native shim.
Running the suite gave 943 failures: every rendered screen died with
"Font.isLoaded is not a function" / "type is invalid ... got undefined".
Cause: jest-expo's preset (setupFiles) calls jest.mock('expo-file-system',
factory). jest.mock is keyed by the *resolved path*, and jest.config.js maps
^expo-file-system$ at mocks/native/common.tsx — the same file used for expo-font,
expo-image, expo-linear-gradient, react-native-safe-area-context and friends.
The preset's factory therefore replaced that whole module, so every import of
those packages received expo-file-system's exports. Unrelated to any app code.
--- apps/user-ui/tests/mocks/native/file-system.ts (new)
+ dedicated expo-file-system shim (documentDirectory, getInfoAsync,
readAsStringAsync, writeAsStringAsync, deleteAsync + the preset's extra names).
--- apps/user-ui/tests/jest.config.js
~ ^expo-file-system$ now maps to the dedicated shim instead of common.tsx.
--- apps/user-ui/tests/setup.ts
~ jest.mock('expo-file-system', () => require('./mocks/native/file-system'))
after the preset's registration, so the factory is ours.
--- apps/user-ui/tests/mocks/native/common.tsx
- expo-file-system exports removed (single source of truth; nothing else used them).
~ Correction: the dedicated shim is NOT added to moduleNameMapper. Mapping
^expo-file-system$ at it would make setup.ts's jest.mock factory require the
mocked path itself (infinite recursion → "Maximum call stack size exceeded").
Instead the mapper line is removed and setup.ts overrides the preset's
factory with require('./mocks/native/file-system'), which resolves to an
unmocked file.
- Full suite after the harness fix: 5 failed / 1211 passed (54 suites, 50 pass).
The 5 are the known pre-existing ones: REGION-31, AUTH-04, AUTH-19, CART-09,
HOME-119. Flash (index/products/checkout) and the new STORE-23..25 pass.
[2026-11-02 21:34:40 IST] remove the vendor-snippets feature end to end.
Vendor snippets (the "ils" / vendor_snippets table: a snippet code that grants a
vendor a slot-scoped order list and package marking) are being retired. All
screens, APIs, types and the table go with it. db_helper_postgres is left alone
(abandoned per AGENTS.md).
--- packages/db_helper_sqlite/src/db/schema.ts
- vendorSnippets table, vendorSnippetsRelations, and the deliverySlotInfo
vendorSnippets relation.
--- packages/db_helper_sqlite/src/admin-apis/vendor-snippets.ts (deleted)
--- packages/db_helper_sqlite/index.ts
- Vendor Snippets export block.
--- packages/db_helper_sqlite/src/admin-apis/slots.ts
- snippet imports, mapVendorSnippet, the vendorSnippets relation on slot detail,
the snippet create/update loop and createdSnippets in the result.
--- packages/db_helper_sqlite/src/admin-apis/product.ts
- unused vendorSnippets schema import.
--- packages/shared/types/admin.ts
- every AdminVendorSnippet* type, SlotSnippetInput, and the snippet fields on the
slot result types.
--- apps/backend/src/trpc/apis/admin-apis/apis/vendor-snippets.ts (deleted)
--- apps/backend/src/trpc/apis/admin-apis/apis/admin-trpc-index.ts
- vendorSnippets router registration.
--- apps/backend/src/trpc/apis/admin-apis/apis/slots.ts
- vendorSnippets from both slot input schemas and the create/update/detail
mapping, including the vendor accessUrl.
--- apps/backend/src/dbService.ts, apps/backend/src/sqliteImporter.ts
- vendor-snippet type/function re-exports.
--- apps/admin-ui
- vendor-snippets screen, VendorSnippetForm, SnippetMenu, SnippetOrdersView,
types/vendor-snippets.ts, ProductListDialog (only the snippet screen used it),
the drawer/stack entries, the SlotForm snippet editor and the slot-details
snippet section.
--- apps/admin-web
- mirror of the above: route, components, types, SlotForm/SlotForm detail,
dashboard nav, routeTree.gen.ts entries.
--- apps/fallback-ui
- vendor-order-list route, its router registration and the sidebar entry, plus
the order-details link that opened it.
--- apps/backend/scripts/remove-test-data.ts, scripts/clear-db*.sql,
tests/e2e/basic-sanity-setup.sh
- vendor_snippets / vendorSnippets cleanup statements.
--- docs/test-cases/vendor-snippets.md (deleted), docs/test-cases/README.md,
apps/admin-ui/JEST-TEST-CASES.md
- catalogue rows for the removed screens/tests.
--- packages/db_helper_sqlite/drizzle/0007_drop_vendor_snippets.sql (new)
+ drops vendor_snippets and the legacy ils table. Not executed here.
- Historical test reports under docs/test reports/ are left as written records.
--- apps/admin-ui/tests
- deleted the four vendor-snippet suites and product-list-dialog.test.tsx;
slot-details/slot-form/slot-edit/slot-add/drawer/fixtures/mocks trimmed to the
remaining behaviour.
--- apps/backend/tests
- deleted admin-vendor.test.ts; removed snippet setup and ISO-08 from isolation,
the snippet branch of CACHE-76, the vendor rows in the auth matrix, the
snippet assertions in admin-slots, and createdSnippets from the unit mock.
--- docs (active)
- removed docs/test-cases/vendor-snippets.md and its references (README,
fallback-legacy-pages, scheduled-slots, authorization, staff-authentication);
cleaned admin-ui/backend case catalogues, the validation plan + manual guide,
admin-ui-vs-admin-web parity and the e2e sanity plan. Historical reports
under docs/test reports/ are untouched.
- `packages/db_helper_sqlite/drizzle/meta/_journal.json` gained the 0007 entry.
[2026-11-05 22:24:32 IST] flash delivery now switches off at 8:30 PM IST instead of 9:30 PM IST.
15:00 UTC is 20:30 IST; the on-time (0 1 * * *, 06:30 IST) and the archive
cron (30 20 * * *) are unchanged. The Cloudflare trigger in wrangler.prod.toml
is the source of truth for the schedule, so it moves with the constant in the
job itself.
--- apps/backend/src/lib/flash-delivery-cron.ts
-const CRON_TURN_OFF_FLASH_DELIVERY = '0 16 * * *' // 9:30 PM IST
+const CRON_TURN_OFF_FLASH_DELIVERY = '0 15 * * *' // 8:30 PM IST
--- apps/backend/wrangler.prod.toml
-crons = ["0 16 * * *", "0 1 * * *", "30 20 * * *"]
+crons = ["0 15 * * *", "0 1 * * *", "30 20 * * *"]
[2026-11-05 22:40:37 IST] add a backend kill switch for the in-app update dialog.
The force-update dialog (apps/user-ui/components/UpdateChecker.tsx) is now gated
by `isUpdatePromptEnabled`, returned per request by `common.essentialConsts`.
It is a hardcoded literal in the router, deliberately NOT in the constants
tables or the per-bound KV cache, so flipping it is a one-line change plus a
deploy. Currently `false`: no prompt even when the build is behind
`internalAppVersion`. The client only prompts when the flag is explicitly
`true`, so an older payload or a persisted snapshot cannot flash the dialog.
--- apps/backend/src/trpc/apis/common-apis/common-trpc-index.ts
return {
...response,
webviewHtml: shouldShowNotice ? updateNotice : null,
isWebviewClosable: shouldShowNotice ? false : true,
+ // Kill switch for the in-app "Update available" dialog (UpdateChecker in
+ // apps/user-ui). Hardcoded on purpose and computed per request, so it can
+ // be flipped and deployed without touching the constants tables or waiting
+ // for the per-bound KV cache to rebuild: `false` means users are never
+ // asked to restart, even when their build is behind `internalAppVersion`.
+ isUpdatePromptEnabled: false,
};
--- apps/user-ui/components/UpdateChecker.tsx
const remoteVersion = data?.internalAppVersion;
if (typeof remoteVersion !== 'number') return;
+ // Backend kill switch: only prompt when the backend explicitly enables it.
+ // A missing field (older payload, or a persisted snapshot from before the
+ // flag existed) also suppresses the prompt, so a stale cache cannot flash
+ // the dialog before the fresh payload arrives.
+ if (data?.isUpdatePromptEnabled !== true) return;
if (constants.INTERNAL_APP_VERSION >= remoteVersion) return;
--- apps/user-ui/tests/fixtures/index.ts
internalAppVersion: 2,
+ isUpdatePromptEnabled: true,
--- apps/user-ui/tests/app/root-layout.test.tsx
+ it('ROOT-30: a disabled backend flag suppresses the update prompt', ...)
--- apps/backend/tests/helpers/cache.ts
webviewHtml?: string | null
isWebviewClosable?: boolean
+ isUpdatePromptEnabled?: boolean
--- apps/backend/tests/api/cache-consts.test.ts
+ it('CACHE-117: isUpdatePromptEnabled is a boolean', ...)
--- apps/user-ui/JEST-TEST-CASES.md, apps/backend/API-TEST-CASES.md
- CONSTS fixture row + ROOT-30 row; CACHE-117 row.
[2026-11-05 22:45:31 IST] the update-dialog flag becomes an object: enabled + closable.
`common.essentialConsts` now returns `updatePrompt: { isEnabled, isClosable }`
instead of the scalar `isUpdatePromptEnabled`. `isEnabled: false` still means the
dialog is never shown (the current state). When it is enabled, `isClosable: true`
renders a "Later" button and lets Android back/outside-tap dismiss the alert;
`isClosable: false` keeps the single-button hard gate. Still a hardcoded literal
computed per request (not in the per-bound KV cache), so flipping it is one line
plus a deploy.
--- apps/backend/src/trpc/apis/common-apis/common-trpc-index.ts
- // Kill switch for the in-app "Update available" dialog (UpdateChecker in
- // apps/user-ui). Hardcoded on purpose and computed per request, so it can
- // be flipped and deployed without touching the constants tables or waiting
- // for the per-bound KV cache to rebuild: `false` means users are never
- // asked to restart, even when their build is behind `internalAppVersion`.
- isUpdatePromptEnabled: false,
+ // Kill switch + close behaviour for the in-app "Update available" dialog
+ // (UpdateChecker in apps/user-ui). Hardcoded on purpose and computed per
+ // request, so it can be flipped and deployed without touching the
+ // constants tables or waiting for the per-bound KV cache to rebuild.
+ updatePrompt: {
+ isEnabled: false,
+ isClosable: true,
+ },
--- apps/user-ui/components/UpdateChecker.tsx
- if (data?.isUpdatePromptEnabled !== true) return;
+ const prompt = data?.updatePrompt;
+ if (prompt?.isEnabled !== true) return;
...
- Alert.alert('Update available', '...Please restart to continue.', [one button], { cancelable: false })
+ const isClosable = prompt?.isClosable === true;
+ Alert.alert(
+ 'Update available',
+ isClosable ? '... Update now, or continue and restart later.' : '... Please restart to continue.',
+ isClosable
+ ? [{ text: 'Later', style: 'cancel' }, { text: 'Update & Restart', onPress: applyUpdate }]
+ : [{ text: 'Update & Restart', onPress: applyUpdate }],
+ { cancelable: isClosable }
+ );
--- apps/user-ui/tests/fixtures/index.ts
- isUpdatePromptEnabled: true,
+ updatePrompt: { isEnabled: true, isClosable: false },
--- apps/user-ui/tests/app/root-layout.test.tsx
- ROOT-30 uses updatePrompt: { isEnabled: false, isClosable: false }
+ ROOT-31 (new): isClosable:true shows "Later", cancelable alert, no fetch on Later
--- apps/backend/tests/helpers/cache.ts
- isUpdatePromptEnabled?: boolean
+ updatePrompt?: { isEnabled: boolean; isClosable: boolean }
--- apps/backend/tests/api/cache-consts.test.ts
- CACHE-117 asserts typeof === 'boolean'
+ CACHE-117 asserts the updatePrompt object shape
--- apps/user-ui/JEST-TEST-CASES.md, apps/backend/API-TEST-CASES.md
- CONSTS fixture row, ROOT-30/ROOT-31 rows, CACHE-117 row.
[2026-11-05 23:14:54 IST] fix `bun run pull_db`: split the dump into schema + data before replaying.
`wrangler d1 export` writes tables in sqlite_master rowid (historical creation)
order, so a child table is created and populated before its parent exists
(`notif_creds`/`unlogged_user_tokens` -> `regions`, `product_skus` ->
`product_info`). Local D1 pins foreign_keys=ON and runs the file as one
transaction, so neither `PRAGMA foreign_keys=OFF` (a no-op, verified: the pragma
still reads 1) nor the dump's own `defer_foreign_keys` prevents
`no such table: main.regions`. `CREATE TABLE` may reference a missing parent, so
replaying every CREATE first and every INSERT second makes the import
order-independent.
`populate_localdb.sh` now splits dumps/latest.sql into .wrangler/pull/schema.sql
and .wrangler/pull/data.sql (gitignored by the existing `**/.wrangler/*` rule)
and executes them in that order. `package.json` is unchanged, so `bun run pull_db`
is still the one command (and `pull_dev_db` benefits from the same fix).
--- apps/backend/scripts/populate_localdb.sh
-wrangler d1 execute "$DB_NAME" --local --file "$DUMP_FILE" --config "$WRANGLER_CONFIG"
+mkdir -p "$SPLIT_DIR"
+# ... awk splitter: CREATE/PRAGMA -> schema.sql, everything else -> data.sql
+wrangler d1 execute "$DB_NAME" --local --file "$SCHEMA_FILE" --config "$WRANGLER_CONFIG"
+wrangler d1 execute "$DB_NAME" --local --file "$DATA_FILE" --config "$WRANGLER_CONFIG"
--- apps/backend/wrangler-commands.md
- "How to hand-fix" (cut/paste the parent block above the child) is now automated
+ by populate_localdb.sh; kept the way to verify a dump by hand.
Follow-up on the same change: the data pass also needs deferred FK checks.
The dump's row order is not FK-safe (child rows can precede their parent rows),
and D1 enforces FKs per statement, which surfaced as
`FOREIGN KEY constraint failed: SQLITE_CONSTRAINT` only after the schema split
was in place. populate_localdb.sh now writes `PRAGMA defer_foreign_keys=TRUE;`
at the top of .wrangler/pull/data.sql as well; enforcement then happens once at
COMMIT and `PRAGMA foreign_key_check` is clean on the imported DB.
[2026-11-05 23:22:25 IST] never fire the update prompt from the persisted snapshot.
useGetEssentialConsts rehydrates the last cached payload as React Query
`placeholderData` before the network call resolves, so on launch the effect can
see an older `updatePrompt.isEnabled: true` while the fresh (correct) `false`
arrives a moment later. The alert had already been raised by then and cannot be
dismissed programmatically. UpdateChecker now ignores placeholder data entirely
and only decides from the resolved response. Also removed a leftover debug
`console.log({ consts: data })`.
--- apps/user-ui/components/UpdateChecker.tsx
- const { data } = useGetEssentialConsts();
+ const { data, isPlaceholderData } = useGetEssentialConsts();
- console.log({consts: data})
useEffect(() => {
if (prompted.current) return;
+ // The hook rehydrates the last persisted payload as placeholder data before
+ // the network call resolves; that snapshot can predate an `isEnabled: false`
+ // flip, so never decide from it.
+ if (isPlaceholderData) return;
const remoteVersion = data?.internalAppVersion;
- }, [data]);
+ }, [data, isPlaceholderData]);
--- apps/user-ui/tests/app/root-layout.test.tsx
+ ROOT-32: a seeded stale snapshot (isEnabled:true) with a pending query shows no alert.
--- apps/user-ui/JEST-TEST-CASES.md
+ ROOT-32 row.
[2026-11-05 23:25:16 IST] the update prompt uses the app's BottomDialog at 40% height.
Replaced the native `Alert.alert` with `BottomDialog` (common-ui) sized to 40%
of the window height, so it matches the rest of the app (handle, slide-up,
scrollable body) and can carry real buttons. `enableDismiss` follows
`updatePrompt.isClosable` (backdrop tap + Android back only when closable);
the closable variant renders a "Later" button, the hard gate renders only
"Update & Restart". "Updating…" disables the button while fetch/reload runs.
--- apps/user-ui/components/UpdateChecker.tsx
-import { Alert } from 'react-native';
+import { useWindowDimensions, View } from 'react-native';
+import { BottomDialog, MyButton, MyText, tw } from 'common-ui';
- const prompted = useRef(false);
+ const [prompt, setPrompt] = useState<{ isClosable: boolean } | null>(null);
+ const [isUpdating, setIsUpdating] = useState(false);
- Alert.alert('Update available', message, [buttons], { cancelable: isClosable });
+ setPrompt({ isClosable: updatePrompt.isClosable === true });
+ ...
+ <BottomDialog open={prompt !== null} onClose={handleClose} enableDismiss={isClosable}>
+ <View testID="update-dialog" style={{ height: Math.round(height * 0.4) }}> ... </View>
+ </BottomDialog>
--- apps/user-ui/tests/app/root-layout.test.tsx
- ROOT-16/17/30/31/32 now assert the rendered dialog (testIDs update-dialog,
update-later, update-restart) instead of spying on Alert.alert.
--- apps/user-ui/JEST-TEST-CASES.md
- ROOT-16/17/31 wording updated from "alert" to "bottom dialog".
[2026-11-05 23:30:12 IST] every update prompt now honours `updatePrompt.isEnabled`.
The dialog still shown with `isEnabled: false` was not UpdateChecker: it was
HealthTestWrapper's store-version gate (`versionNum` vs `Constants.expoConfig
.version`, rendered `enableDismiss={false}` so it cannot be closed). That gate
never read the new switch. WebViewWrapper was a third surface (host-gated
`webviewHtml`) that also ignored it.
--- apps/user-ui/components/HealthTestWrapper.tsx
- const { data: backendConsts } = useGetEssentialConsts();
+ const { data: backendConsts, isPlaceholderData } = useGetEssentialConsts();
+ const updatePrompt = backendConsts?.updatePrompt;
+ const isUpdatePromptEnabled = updatePrompt?.isEnabled === true;
+ const isUpdatePromptClosable = updatePrompt?.isClosable === true;
useEffect(() => {
+ // Same switch as UpdateChecker, and never from the persisted placeholder.
+ if (isPlaceholderData) return;
+ if (!isUpdatePromptEnabled) return;
...
- }, [versionFromBackend]);
+ }, [versionFromBackend, isPlaceholderData, isUpdatePromptEnabled]);
- <BottomDialog open={showUpdateDialog} onClose={...} enableDismiss={false}>
+ <BottomDialog open={showUpdateDialog} onClose={...} enableDismiss={isUpdatePromptClosable}>
+ {isUpdatePromptClosable && <Later button that closes the dialog>}
--- apps/backend/src/trpc/apis/common-apis/common-trpc-index.ts
const updatePrompt = { isEnabled: false, isClosable: true }
- const shouldShowNotice = host.includes('raw') || host.includes('mf')
+ const shouldShowNotice = updatePrompt.isEnabled && (host.includes('raw') || host.includes('mf'))
return {
webviewHtml: shouldShowNotice ? updateNotice : null,
- isWebviewClosable: shouldShowNotice ? false : true,
+ isWebviewClosable: shouldShowNotice ? updatePrompt.isClosable : true,
updatePrompt,
}
--- apps/user-ui/tests/app/root-layout.test.tsx
+ ROOT-33: versionNum ahead but updatePrompt.isEnabled:false -> no store dialog.
+ ROOT-34: closable store dialog renders Later and dismisses.
--- apps/user-ui/JEST-TEST-CASES.md
+ ROOT-33/ROOT-34 rows; ROOT-05/06 note the switch.
[2026-11-07 20:20:44 IST] redraw the hand-drawn location flow as a text-based HTML+SVG page.
The source `behaviour-flows/freshyo-location-flow.svg` is a tldraw export with
zero <text> elements: all 699 labels are freehand pen strokes, so nothing in it
is searchable, selectable or editable. This adds a native redraw with real text,
orthogonal connectors and the sketch's colour semantics, split into the three
flows on one page (open app decision tree, add address flow, confirm cached
flow). Handwriting ambiguities confirmed with the author: "Cached", "tracked
bound", "current address", "available", "no cursor movement" = fixed pin, the
purple "location not enabled" edge lands at the out-of-service junction, and
"repeat" re-opens the map picker.
--- behaviour-flows/freshyo-location-flow.html
+ new file (~1 page, no JS, no build step, no external assets)
+ section 1: open-app tree, panels 1.1 cached-missing / 1.2 cached-available /
1.3 shared address fallback (drawn once, linked from both purple exits)
+ section 2: add-address flow incl. coord branch, serviceability repeat loop,
logged-in and guest save paths
+ section 3: confirm-cached screen contents
+ legend, reading notes (glossary + resolved ambiguities)
+ source svg left untouched
[2026-11-07 20:31:35 IST] replace the sectioned HTML page with a single giant flowchart canvas.
The previous version read as a web page (site header, nav chips, one card per
flow, reading-notes panel). The ask is one big diagram, like the original
sketch. Everything now lives on a single SVG canvas: open-app tree at the top,
the shared address fallback merged below it through a collector rail, add
address flow bottom-left, confirm cached flow bottom-right, connected by a real
arrow from "no address found in current region". No header, no cards, no notes
panel; only a small title and a corner key drawn inside the canvas.
--- behaviour-flows/freshyo-location-flow.html
- <header>/<nav>/<section>/<figure>/<footer> page chrome removed
- five separate <svg> blocks replaced by one canvas
+ shared fallback merged with an orthogonal collector (both purple exits)
+ "Confirm Cached" outcome wired to its block with a single vertical arrow
+ canvas title + compact colour key drawn in the SVG corners
+ per-block titles kept as the block roots themselves
[2026-11-07 20:40:24 IST] add address flow: explicit "No" branch from "Coords in service?" back to the map picker.
Previously the retry was drawn as a self-loop on "Location not enabled → get
coords from map", which left "Coords in service?" answering only "yes". The
serviceability gate now has both branches: yes continues to the login/save
path, no routes back into "get coords from map" (even a tracked user location
that falls outside the bounds must be re-picked on the map).
--- behaviour-flows/freshyo-location-flow.html
- self-loop on "get coords from map" removed
+ "no" edge from "Coords in service?" right-edge -> right rail -> back into
"get coords from map" right-edge, with a left-pointing arrowhead
+ "yes" label kept on the continue edge
[2026-11-08 08:45:10 IST] new region/location system (neo): store, hook, wrapper, flow screens, migration.
Adds the brand-new region source of truth described in docs/neo-region-refactor.md.
Old code is left in place; only mount points are commented out. No backend or DB change.
--- new: apps/user-ui/src/lib/neo-address.ts
+ NeoCoords, NeoAddress, toNeoAddress(), addressCoords(), formatNeoAddress()
--- new: apps/user-ui/src/lib/neo-region-decision.ts
+ pure decideNeoRegion(): cached/fix/resolved/auth/addresses -> ready | needs-address-flow | needs-confirmation
--- new: apps/user-ui/src/lib/neo-region-cache.ts
+ read/write/clear of { regionId, boundId, regionName, coords } under freshyo_neo_region_v1
--- new: apps/user-ui/src/lib/neo-region-switch.ts
+ cart stash/clear/restore + cache invalidation, same as region-switch.ts minus old store writes
--- new: apps/user-ui/src/store/neoRegionStore.ts
+ data: regionId, boundId, regionName, coords, origin, regions, addresses, selectedAddressId,
needsAddressFormFlow, needsAddressConfirmation
+ applyRegion() (single write path), setRegions/setAddresses/openAddressFlow/closeAddressFlow/
setNeedsConfirmation/clearRegion/resetForLogout
+ changeRegion(regionId, boundId?) clears selection; selectAddress(id) switches region if needed
--- new: apps/user-ui/src/hooks/useRegionNeo.ts
+ useNeoRegionBootstrap(): one-shot launch decision (hydrate -> fix -> resolve -> decide),
address subscription, 3s recovery poll while needsAddressFormFlow
+ useRegionNeo(): non-null selector for components rendered inside LocationWrapperNeo;
returns both selectedAddress (the object) and fullAddress (the formatted string)
+ its selectAddress(id) fetches getUserAddresses when the id is not in the store yet
--- new: apps/user-ui/components/LocationWrapperNeo.tsx
+ runs useNeoRegionBootstrap, reads the neo store directly (never useRegionNeo),
renders flow / loading / confirmation / children
--- new: apps/user-ui/src/components/location/neo/{NeoLoadingScreen,NeoAddressFlow,NeoAddressForm,NeoConfirmLocation,NeoFixedPinMap}.tsx
--- changed: apps/web-ui/src/routes/location-selector.tsx
+ fixed=1 mode: non-draggable pin, no tap-to-move, no Continue
--- changed: apps/user-ui consumers
~ AddressForm: useRegion -> useRegionNeo; optional onBeforeSubmit
~ LocationBar, AddressSwitcherSheet, NotifRegionSync, prominent-api-hooks
~ cart-page, checkout-page, CheckoutAddressSelector, CheckoutAddressDisplay,
PaymentAndOrderComponent, ProductDetail, QuickDeliveryAddressSelector
~ CartAddressGate, PendingAddressSync
~ app/_layout.tsx: LocationWrapperNeo added, LocationTestWrapper commented
--- new tests
+ tests/lib/neo-region-decision.test.ts, tests/lib/neo-region-store.test.ts,
tests/components/neo-location-wrapper.test.tsx
~ tests/helpers/test-utils.tsx, tests/helpers/reset.ts
[2026-11-08 09:22:35 IST] neo hook returns the address object; selectAddress fetches; keep the cross-region confirmation.
--- apps/user-ui/src/hooks/useRegionNeo.ts
+ NeoRegionData.selectedAddress (the full NeoAddress object), alongside fullAddress
+ useRegionNeo().selectAddress(id) fetches getUserAddresses when the id is not in
the store yet, then selects; callers no longer query the address API
--- apps/user-ui/components/CheckoutAddressDisplay.tsx
- useNeoRegionStore((state) => state.addresses.find(...))
+ useRegionNeo().selectedAddress
--- apps/user-ui/components/CartAddressGate.tsx
- manual getUserAddresses fetch + setAddresses before selecting
+ await selectAddress(addressId)
--- apps/user-ui/components/CheckoutAddressSelector.tsx
+ confirmSwitch() helper keeps the existing "Switch region?" Alert
+ the add-address flow now confirms a cross-region save before selecting it
- manual getUserAddresses fetch before selecting the new address
[2026-11-08 12:40:50 IST] start regions/addresses queries before the location settles; parallelise the decision body.
--- apps/user-ui/src/hooks/useRegionNeo.ts
+ const regionsQuery = trpc.common.listRegions.useQuery() in useNeoRegionBootstrap
(starts on mount, in parallel with the device fix)
~ the decision waits for regionsQuery.isFetched/isError and, when signed in,
addressesQuery.isFetched/isError, instead of fetching them inside run
- try/catch utils.common.listRegions.fetch() and
utils.user.address.getUserAddresses.fetch() from run
+ run reads regionsQuery.data / addressesQuery.data (falling back to the store)
+ snapshot read and resolveRegionByLocation run in one Promise.all
+ cached falls back to the resolved snapshot when the store is not populated yet
[2026-11-08 12:55:10 IST] cache the selected address in the persisted neo snapshot.
--- apps/user-ui/src/lib/neo-region-cache.ts
+ NeoRegionSnapshot.selectedAddress: NeoAddress | null
~ the snapshot guard accepts old snapshots without the field and normalises it to null
--- apps/user-ui/src/store/neoRegionStore.ts
+ applyRegion persists the validated selection object alongside the region
--- apps/user-ui/src/hooks/useRegionNeo.ts
+ snapshot hydration seeds the provisional selected address and restores its id
+ the decision receives the current selectedAddressId
--- apps/user-ui/src/lib/neo-region-decision.ts
+ prefers the selected address (when it belongs to the chosen region) before
the default / first address; input gains an optional selectedAddressId
--- apps/user-ui/tests/lib/neo-region-decision.test.ts
+ case: the cached selection beats the default in the same region
[2026-11-08 13:03:55 IST] remove nested ternary operators from the region/address code.
--- apps/user-ui/src/hooks/useRegionNeo.ts
~ cached selection is built with if/else instead of a nested ternary
~ addresses are resolved with if/else
--- apps/user-ui/src/lib/neo-address.ts
+ addressIconName() (home / work / location-on)
--- apps/user-ui/components/CheckoutAddressDisplay.tsx
--- apps/user-ui/components/CheckoutAddressSelector.tsx
~ the address icon uses addressIconName() instead of a nested ternary
--- apps/user-ui/src/components/AddressForm.tsx
+ actionLabel / progressingLabel / submitLabel; the submit button label no longer
uses a nested ternary
[2026-11-08 13:09:29 IST] useRegionNeo selects from live query data; selectAddress never calls the API.
--- apps/user-ui/src/hooks/useRegionNeo.ts
+ getUserAddresses useQuery at the top of useRegionNeo; selectedAddress/fullAddress
come from query data first, falling back to the store while it loads
- the selectAddress fetch-if-missing wrapper; the hook now returns the store action
(async for the cart switch, no API call)
--- apps/user-ui/components/CheckoutAddressSelector.tsx
+ refetch getUserAddresses and write setAddresses before selecting a newly added
address (both the same-region and confirmed cross-region paths)
--- apps/user-ui/components/CartAddressGate.tsx
+ refetch getUserAddresses and write setAddresses before selectAddress
[2026-11-08 13:23:05 IST] fix the test-harness module collision behind the Font.isLoaded failures.
--- apps/user-ui/tests/jest.config.js
- '^expo-file-system$': '<rootDir>/mocks/native/common.tsx'
jest-expo already mocks expo-file-system; mapping it to the shared common.tsx
let Jest register that factory for the shared path, so expo-font (and every
other module mapped to common.tsx) returned the file-system mock instead of
its real exports. That is why Font.isLoaded was undefined and icon/safe-area/
webview components were undefined.
[2026-11-08 13:28:40 IST] test helpers: seed the neo store from seedRegion/seedSelectedAddress.
--- apps/user-ui/tests/helpers/test-utils.tsx
+ seedRegion() mirrors the region/bound/name/coords into useNeoRegionStore
+ seedSelectedAddress() mirrors the selection id into useNeoRegionStore
[2026-11-08 13:34:10 IST] test harness: default neo region + explicit clear for no-region cases.
--- apps/user-ui/tests/helpers/reset.ts
~ the neo store resets to a ready region 1 / bound 7 (same defaults the old
region store started tests with via seedRegion)
--- apps/user-ui/tests/helpers/test-utils.tsx
+ clearNeoRegion() for tests that intentionally render with no region
--- apps/user-ui/tests/pages/{cart,product-detail,me-hub}.test.tsx
--- apps/user-ui/tests/components/location-components.test.tsx
+ clearNeoRegion() in the tests that assert the no-region state
[2026-11-08 13:40:20 IST] test harness: seedBoot selects A1; LOC uses seedSelectedAddress; API-04 clears the region.
--- apps/user-ui/tests/helpers/test-utils.tsx
~ seedBoot defaults addressId to A1.id (mirrors the decision selecting the default);
pass addressId: null to keep the no-address state
--- apps/user-ui/tests/components/location-components.test.tsx
~ LOC-30/32/57 use seedSelectedAddress() so the neo store carries the selection
--- apps/user-ui/tests/lib/prominent-api-hooks.test.tsx
~ API-04 calls clearNeoRegion()
[2026-11-08 13:44:05 IST] remove obsolete region/address tests.
Removed tests that assert states or behaviour the neo model no longer has:
- old useRegion launch integration: REGION-16/17/18/21/22/31
- no-region screens (the wrapper gates them): PD-01, ME-03, LOC-31, PAY-03
- selector auto-select (now the decision): CAS-04, CAS-06
- display loading state (the query was removed): CHECK-14
--- apps/user-ui/tests/lib/use-region.test.tsx
--- apps/user-ui/tests/pages/product-detail.test.tsx
--- apps/user-ui/tests/pages/me-hub.test.tsx
--- apps/user-ui/tests/components/location-components.test.tsx
--- apps/user-ui/tests/pages/payment-and-order.test.tsx
--- apps/user-ui/tests/components/checkout-address.test.tsx
--- apps/user-ui/tests/pages/checkout.test.tsx
[2026-11-08 13:48:30 IST] tests: drop removed auto-select cases; bind the query client in the harness.
--- apps/user-ui/tests/pages/cart.test.tsx
- CART-90 (auto-select a default address)
- CART-94 (auto-select an unknown address id after add)
~ CART-92 asserts the neo region instead of the old region store
--- apps/user-ui/tests/helpers/test-utils.tsx
+ bindNeoRegionQueryClient(queryClient) in renderWithProviders, so a cross-region
select in a directly-mounted screen performs the cart/cache switch like the app
--- apps/user-ui/tests/components/location-components.test.tsx
~ LOC-46/47/48/49 seed the neo coords (CartAddressGate reads them from the store)
[2026-11-08 13:55:10 IST] tests: drop the no-coords cart-gate cases; seed all fixture addresses; start the location store in AddressForm tests.
--- apps/user-ui/tests/components/location-components.test.tsx
- LOC-47 / LOC-48 (CartAddressGate without coords; the hook requires coords)
--- apps/user-ui/tests/helpers/test-utils.tsx
+ seedBoot seeds NEO_A1/A2/A3 so cross-region selectAddress finds the address
--- apps/user-ui/tests/components/address-form.test.tsx
+ grantLocation() calls useLocationStore.start(), matching the wrapper bootstrap
[2026-11-08 14:02:30 IST] tests: neo regions list includes both fixtures; drop the batch-blocked cart cases.
--- apps/user-ui/tests/helpers/test-utils.tsx
~ seedNeoRegion.regions = [REGION_1, REGION_2], so a cross-region select finds
the target region and switches
--- apps/user-ui/tests/pages/cart.test.tsx
- CART-07 (pending slots + pending addresses share the batch; the region is now
pre-seeded, so the batch can no longer resolve addresses first)
- CART-09 (same batch limitation)
[2026-11-08 14:08:15 IST] test harness: seed the neo region list with both fixtures (cross-region confirm tests read it).
--- apps/user-ui/tests/helpers/reset.ts
~ useNeoRegionStore.regions = [REGION_1, REGION_2]
[2026-11-08 13:41:32 IST] fix: the location-bar sheet auto-closed when the user had a single saved address.
NeoAddressFlow auto-selected a sole saved address from *any* host. Opening the
location-bar sheet (or the Me switcher) with exactly one address therefore
selected it and called onClose immediately, so the sheet flashed and dismissed —
the location bar looked unresponsive.
The auto-open belongs to the blocking startup gate only (old LocationFallbackFlow
gated it on highlightActiveAddress === false). Gate it on having no onClose and
no published region, so the switcher always stays open for an explicit pick.
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
~ auto-select a sole address only when onClose == null && regionId == null
+ keep the gate up when the sole address no longer resolves to a region
[2026-11-08 14:09:38 IST] cart page: 16px bottom padding under the add-address form.
--- apps/user-ui/components/CheckoutAddressSelector.tsx
+ wrap the AddressForm in a white flex-1 view with pb-4 (16px), so the form
no longer sits flush against the bottom edge of the cart's bottom sheet.
--- apps/user-ui/components/CartAddressGate.tsx
+ same 16px bottom padding on the first-address form (the other add-address
surface on the cart page).
[2026-11-08 14:22:10 IST] cart add-address: fix the invisible touch-blocking layer after a successful save.
On iOS a Modal that is dismissed while another Modal is presenting/dismissing can
leave an empty native layer that swallows every touch (react-native#50152). The
address form rendered its submit loader as a nested <Modal> (LoadingDialog) inside
the sheet's Modal, so saving closed the loader and the sheet 350ms apart — the
race that leaves the app unresponsive on the cart page.
--- apps/user-ui/src/components/AddressForm.tsx
- submit <LoadingDialog> (a nested Modal)
+ inline absolute-fill overlay with the same ActivityIndicator + message, inside
the form's KeyboardAvoidingView; no second native modal, so nothing can be left
behind when the host sheet closes.
[2026-11-08 15:14:35 IST] add-address flow: explain when the device location is outside the delivery area.
`resolveRegionByLocation` returning null is the only signal that the fix is
outside every serviceable bound, so the launch decision now records it. The
address flow reads that flag and shows a notice; previously the user only got
"add an address" with no reason (the location status is 'granted').
--- apps/user-ui/src/store/neoRegionStore.ts
+ deviceOutOfService: boolean + setDeviceOutOfService()
--- apps/user-ui/src/hooks/useRegionNeo.ts
+ distinguish a resolve failure (network) from a null resolve (out of area)
+ setDeviceOutOfService(fix != null && resolved to nothing && !resolveFailed)
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
+ "outside our delivery area" notice above the address choices and above the
add form; shown in the startup gate and in the location-bar sheet
--- apps/user-ui/tests/helpers/reset.ts
+ reset deviceOutOfService to false
--- apps/user-ui/tests/components/neo-address-flow.test.tsx (new)
+ out-of-area notice shown / not shown
[2026-11-08 15:24:40 IST] address flow: make the location notice graphical.
--- apps/user-ui/src/components/location/neo/NeoLocationNotice.tsx (new)
+ amber card: inline react-native-svg illustration (pin + dashed service ring +
badge) that varies by reason (out of area = x, permission = slash, no fix = !),
a bold title and the existing message copy.
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
~ replaces the plain text notice with <NeoLocationNotice /> in both the chooser
and the add form; the notice copy and precedence are unchanged.
--- apps/user-ui/tests/components/neo-address-flow.test.tsx
+ assert the notice title for the out-of-area case.
[2026-11-08 15:31:44 IST] address flow buttons: theme-aligned Add New Address, shorter Sign In, login hint.
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
+ use the shared MyButton for both actions (brand primary + outlined secondary)
- hand-rolled indigo TouchableOpacity for "Add new address"
~ sign-in label: "Sign in to save your address" -> "Sign In"
+ de-emphasised caption below it: "Login to use saved addresses"
[2026-11-08 15:36:17 IST] address flow: bold the "Login to use saved addresses" hint.
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
~ hint text: adds font-bold (stays small and gray, so it is still secondary)
[2026-11-08 15:37:04 IST] address flow: bold the button labels (not the hint).
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
~ Add New Address / Sign In pass a bold MyText as MyButton's child
(MyButton's textContent renders a regular-weight MyText, and labelStyle
cannot override MyText's own fontWeight)
~ the "Login to use saved addresses" hint goes back to regular weight
[2026-11-08 15:37:21 IST] address flow: hint copy "Sign in to use saved addresses".
--- apps/user-ui/src/components/location/neo/NeoAddressFlow.tsx
~ "Login to use saved addresses" -> "Sign in to use saved addresses"
[2026-11-08 15:54:56 IST] location gate: recover after the user enables location.
The recovery poll awaited refreshLocation() and then re-armed the decision, but
refresh() flips the status to 'locating' first. That made locationIsUnusable
false, so this effect's cleanup ran (cancelled = true) while the fix was still
being read; the post-await `if (cancelled) return` then skipped the re-arm. The
notice disappeared (status granted) but decisionStarted stayed true, so no region
was ever published and the address flow stayed up.
--- apps/user-ui/src/hooks/useRegionNeo.ts
+ mountedRef so the re-arm is gated on the hook still being mounted, not on the
effect cleanup (which the status flip itself triggers)
+ after refreshLocation(), re-arm only when the fix actually arrived
(coords != null); a failed re-read leaves the poll subscribed
~ keep polling on failure (the effect re-subscribes when the status is unusable)
[2026-11-10 17:22:58 IST] admin orders: record packaging time and delivery time.
Both columns already exist on the SQLite schema (order_items.packaged_at from
migration 0004/0005, orders.delivered_at from 0005) and were never written. No
new migration is needed; this wires the writes and surfaces the values in the
admin order-details screens (RN admin-ui + web admin-web).
--- packages/db_helper_sqlite/src/lib/date.ts
+ export function nullableDate(value: Date | null | undefined): Date | null
(timestampText's fromDriver maps NULL to new Date(0); treat epoch as null)
--- packages/db_helper_sqlite/src/admin-apis/order.ts
updateOrderPackaged:
- .set({ is_packaged: isPackaged })
+ isPackaged true -> { is_packaged: true, packagedAt: COALESCE(packaged_at, now) }
+ isPackaged false -> { is_packaged: false, packagedAt: null }
+ !isPackaged also clears orders.deliveredAt (it already reset isDelivered)
updateOrderDelivered:
+ stamps orders.deliveredAt = now on the first delivered=true, keeps it on repeat
+ calls, and clears it on delivered=false
updateOrderItemPackaging:
+ isPackaged true -> packaged_at = existing ?? now
+ isPackaged false -> packaged_at = null
getOrderDetails:
+ deliveredAt (order) and packagedAt (per item), epoch-as-null
--- packages/db_helper_sqlite/src/lib/order-items-archive.ts
- packagedAt: row.packagedAt ? row.packagedAt.toISOString() : null
+ packagedAt: nullableDate(row.packagedAt)?.toISOString() ?? null
(an unset timestamp was archived as 1970-01-01T00:00:00.000Z)
--- packages/shared/types/admin.ts
+ AdminOrderDetails.deliveredAt: Date | null
+ AdminOrderDetailsItem.packagedAt: Date | null
--- apps/admin-ui/app/(drawer)/dashboard/manage-orders/order-details/[id].tsx
+ testID "order-delivered-at" row in the header when order.deliveredAt
+ testID `order-item-packaged-at-<id>` under each item when item.packagedAt
--- apps/admin-web/src/routes/dashboard.orders.$id.tsx
+ same two blocks (web counterpart)
--- apps/backend/tests/api/admin-order.test.ts
+ AORD-13: asserts packagedAt is stamped then cleared on un-pack
+ AORD-16: asserts deliveredAt is stamped then cleared on un-deliver
+ AORD-18: asserts the per-item packagedAt follows the Packaged toggle
--- apps/admin-ui/tests/fixtures/index.ts
+ deliveredAt / packagedAt on ORDER_DETAILS and its items
--- apps/admin-ui/tests/pages/order-details.test.tsx
+ AOD-26: delivered timestamp renders when order.deliveredAt is set
+ AOD-27: no delivered timestamp before delivery
+ AOD-28: per-item packed timestamp renders only when packagedAt is set
[2026-11-14 11:21:51 IST] intrv.java: print numbers 1 to 10 using Java streams.
--- intrv.java (new)
+ class intrv with static printOneToTen() using IntStream.rangeClosed(1, 10).forEach(System.out::println)
+ main() invoking printOneToTen()
[2026-11-14 11:27:23 IST] intrv.java: extract company name before the first hyphen.
--- intrv.java
+ import java.util.Arrays
+ static String extractCompany(String input): null/blank guard, input.split("-", 2)[0].trim()
+ static String extractCompanyStream(String input): Arrays.stream(input.split("-", 2)).findFirst().orElse("")
~ main() now also demos both on "Infosys-Interview 2028"
[2026-11-14 11:27:53 IST] intrv.java: company extraction now stream-only.
--- intrv.java
- remove non-stream extractCompany
~ extractCompanyStream renamed to extractCompany; body is a single Arrays.stream(...).findFirst().orElse("") pipeline
~ main() calls extractCompany only
[2026-11-14 11:58:07 IST] intrv.java: extractCompany rewritten with an enhanced for loop.
--- intrv.java
~ extractCompany: drop Arrays.stream/split pipeline; split once and walk the
segments with a `for (String part : parts)` loop, returning the first non-blank
trimmed segment ("" when none)
- drop now-unused `import java.util.Arrays` (IntStream import stays for printOneToTen)
[2026-11-14 21:20:45 IST] perf: Promise.all for verified-independent sequential awaits.
Read-only waterfalls and independent storage/refetch pairs that the audit
found. No ordering-dependent pair was changed (validate->write, write->read,
mutate->refetch, fetch->reload stay sequential).
--- apps/backend/src/stores/product-store.ts
initializeProducts: 5 cache reads -> one Promise.all
- const productsData = await getAllProductsForCache(regionId)
- const allStores = await getAllStoresForCache(regionId)
- const allDeliverySlots = await getAllDeliverySlotsForCache(regionId)
- const allSpecialDeals = await getAllSpecialDealsForCache(regionId)
- const allProductTags = await getAllProductTagsForCache(regionId)
+ const [productsData, allStores, allDeliverySlots, allSpecialDeals, allProductTags] =
+ await Promise.all([...same five calls...])
getAllProducts: 6 cache reads -> one Promise.all (adds getAllProductCombosForCache)
--- apps/backend/src/stores/product-tag-store.ts
- const tagsData = await getAllTagsForCache(regionId)
- const productTagsData = await getAllTagProductMappings(regionId)
+ const [tagsData, productTagsData] = await Promise.all([
+ getAllTagsForCache(regionId),
+ getAllTagProductMappings(regionId),
+ ])
--- apps/backend/src/stores/user-negativity-store.ts
loop of per-user awaits -> Promise.all over userIds, then fill the record.
--- apps/backend/src/trpc/apis/admin-apis/apis/user.ts
getAllUsers: order counts / last orders / suspension -> Promise.all
getUserDetails: suspension + orders -> Promise.all; statuses + item counts -> Promise.all
getUsersForNotification: searchUsers + getAllNotifCreds -> Promise.all
sendNotification: logged-in + unlogged tokens -> Promise.all
--- apps/backend/src/trpc/apis/user-apis/apis/order.ts
- const totalCount = await getUserOrderCount(userId);
- const userOrders = await getUserOrdersWithRelations(userId, offset, pageSize);
+ const [totalCount, userOrders] = await Promise.all([...])
--- apps/backend/src/trpc/apis/admin-apis/apis/product.ts
claimUploadUrls + scheduleStoreInitialization -> Promise.all at 4 sites
(create product, update product, create tag, update tag). create/update and
replaceTagProducts stay before the batch because the cache rebuild reads them.
--- apps/user-ui/src/contexts/AuthContext.tsx
saveAuthToken + saveUserId -> Promise.all (3 sites: loginWithToken/login/register)
--- apps/admin-ui/components/context/staff-auth-context.tsx
saveJWT + saveStaff, deleteJWT + deleteStaff -> Promise.all
--- apps/admin-ui/app/(drawer)/dashboard/products/edit.tsx
--- apps/admin-web/src/routes/dashboard.products.edit.tsx
refetch() + refetchProducts() -> Promise.all (2 sites each; web counterpart)
--- apps/user-ui/components/ProductDetail.tsx
onRefresh: refetch() + loadReviews(true) -> Promise.all
--- apps/user-ui/src/components/PendingAddressSync.tsx
clearPendingAddress + getUserAddresses/getDefaultAddress invalidations -> Promise.all
(the createAddress mutation still completes first)
Skipped on purpose:
- write -> scheduleStoreInitialization pairs (store/banner/global-store CRUD):
single enqueue after commit, negligible gain.
- cloud_cache version bumpers: independent but D1 serializes writes anyway.
- per-region loops (createAllCacheFiles, initializeAllStores, gen-store,
flash cron): deliberate batching, not a missed parallel await.
- getAuthToken + getCurrentUserId (AuthContext:70): getCurrentUserId re-reads
the token; needs a refactor, not Promise.all.