Repository: evergreenpos_E-commerce_new (Frontend)
Key Modifications & Feature Enhancements:
Instant Visual Feedback on Swatch Clicks: Refactored
CartItemVariantSelector.tsx
so color focus rings shift immediately (0ms) upon user interaction rather than lagging behind network requests.
In-Place Optimistic Variant Swapping: Updated
Checkout.tsx
and
useCart.tsx
to update line items in place optimistically, matching by composite ID (${baseId}_${sku}) and preventing duplicate line items from appearing.
Debounced Secondary Checkout APIs: Added debouncing for loyalty points calculation (500ms) and referral quotes (400ms) in
Checkout.tsx
, preventing duplicate and aborted API requests during rapid updates.
Performance & API Caching:
Deduplicated Promo Rule Evaluation: Replaced repeated raw API calls in
useCartPromo.ts
with useQuery cached evaluation (staleTime: 5 mins).
Deduplicated Subcategory API Requests: Unified the query keys across
CategoryNavbar.tsx
and
MobileCategorySidebar.tsx
with a 15-minute staleTime, eliminating redundant HTTP calls when opening menus.
Attribute Resolution & UI Layout:
Updated
storefrontUtils.ts
useCartItemResolved to prioritize matched variant attributes over stale product defaults.
Refined responsive spacing, overflow constraints, and header layout in
Header.tsx
and
CategoryNavbar.tsx
.
Repository: evergreen_pos_be (Backend)
Bug Fixes & Technical Changes:
Fixed Mongoose CastError on Cart Modification: In
cart.service.js
(dltPrt), added checks with mongoose.Types.ObjectId.isValid(id) so non-ObjectId UUID customer/user IDs are queried without throwing CastErrors.
Precise Variant Line Pulling: Fixed MongoDB $pull condition to target the exact variant SKU (productId: { $in: searchIds }) when deleting/replacing a specific variant, while safely matching base product IDs using regex (^${lookupId}(_.*)?$) for whole-product removals.
Idempotent Deletion: Removed hard 400 errors when an item was already removed or modified in parallel, preventing sync race conditions with the storefront.