Users were encountering the error: "Failed to place order: The given id must not be null" when attempting to place orders after completing all checkout steps.
In frontend/src/context/CartContext.jsx, the vendorId was being incorrectly converted to a Number when loading from localStorage:
setVendorId(Number(savedVendorId)); // WRONG - converts UUID to NaNSince UUIDs are strings (e.g., "550e8400-e29b-41d4-a716-446655440000"), converting them to Number results in NaN, which serializes to null in JSON. When the backend receives null for vendorId, it throws "The given id must not be null".
Changed 1 line in frontend/src/context/CartContext.jsx:
setVendorId(savedVendorId); // CORRECT - keeps UUID as stringfrontend/src/context/CartContext.jsx- Line 24 (1 line changed)ORDER_PLACEMENT_NULL_ID_FIX.md- Added detailed documentation
- ✅ Order placement now works correctly
- ✅ vendorId is preserved as UUID string throughout the application
- ✅ No breaking changes to existing functionality
- ✅ Minimal, surgical fix (1 line of code changed)
- ✅ Frontend builds successfully without errors
- ✅ Backend compiles successfully without errors
- ✅ No other similar UUID conversion issues found in codebase
- ✅ Cart functionality remains intact
- Add items to cart from any vendor
- Refresh the page (cart loads from localStorage)
- Proceed to checkout
- Fill in delivery details
- Select payment method
- Click "Place Order"
- Result: Order should be placed successfully without null ID error
- Backend expects
UUIDtype forvendorId,slotId, andmenuItemId - Spring Boot's Jackson JSON library requires UUIDs to be sent as strings
- JavaScript doesn't have native UUID type, so they must remain strings
- The fix ensures UUID strings are not corrupted during localStorage operations
- See
ORDER_PLACEMENT_NULL_ID_FIX.mdfor comprehensive technical explanation - See
ORDER_PLACEMENT_FIX_DOCUMENTATION.mdfor previous order placement fixes - See
BUGFIX_SUMMARY.mdfor other bug fixes
e9228f1- Fix vendorId type conversion in CartContext to preserve UUID stringe58d4f0- Add comprehensive documentation for null ID fix
Date: October 20, 2025
Branch: copilot/fix-order-placement-error-again
Status: ✅ Complete - Ready for Testing