# TODO: Variant Collection Spreadsheet Editor Issues ## Status: ⚠️ CRITICAL - NOT PRODUCTION READY ### Issues Identified (November 14, 2025) #### 1. Column Names Not Displaying - **Symptom**: Spreadsheet element is not showing column names/headers - **Impact**: Users cannot see what properties they're editing - **Severity**: HIGH - Makes editor unusable #### 2. Data Not Persisting to Database - **Symptom**: Neither column headers nor cell values are saving to the database - **Impact**: Complete data loss - all entered data is lost on save - **Severity**: CRITICAL - Feature is completely broken ### Previous Fixes Applied (Not Working) 1. ✅ Removed overly aggressive column skip logic (commit `0dbc49e`) - Changed from skipping "Property X" columns to only skipping truly empty names - **Result**: Did not resolve the issue 2. ✅ Fixed column rename persistence with immutable array updates - **Result**: Visual updates work, but data still not persisting 3. ✅ Added comprehensive console logging for debugging - **Status**: Needs browser console inspection to see what's happening ### Files Involved - `/LittleShop/wwwroot/js/variant-editor.js` - Main spreadsheet editor - `/LittleShop/Areas/Admin/Views/VariantCollections/Create.cshtml` - Create view - `/LittleShop/Areas/Admin/Views/VariantCollections/Edit.cshtml` - Edit view - `/LittleShop/Areas/Admin/Controllers/VariantCollectionsController.cs` - Backend controller - `/LittleShop/Services/VariantCollectionService.cs` - Service layer - `/LittleShop/DTOs/VariantCollectionDto.cs` - Data transfer objects ### Next Steps for Debugging 1. **Open browser console** (F12) when testing the editor 2. **Check for JavaScript errors** that might be preventing initialization 3. **Verify form submission** - Check Network tab for POST request 4. **Inspect request payload** - Verify PropertiesJson field is populated 5. **Test server-side** - Add logging to controller Create/Edit methods 6. **Check Handsontable initialization** - Verify library is loading correctly ### Test URL - **Create**: http://localhost:5000/Admin/VariantCollections/Create - **Login**: admin / admin ### Potential Root Causes to Investigate 1. **JavaScript not loading** - Check for 404 errors on variant-editor.js 2. **Handsontable library issue** - Verify handsontable.full.min.js is loading 3. **Form binding issue** - Hidden input might not be in the right place 4. **Serialization timing** - serializeToJSON() might not be called before submit 5. **View rendering issue** - Razor view might have compilation errors 6. **Cache issues** - Browser might be loading old JavaScript despite cache-busting ### Workaround Until this is fixed, variant collections can be created using the JSON textarea fallback: ```json [ { "name": "Size", "values": ["Small", "Medium", "Large"] }, { "name": "Color", "values": ["Red", "Blue", "Green"] } ] ``` ### Priority **DEFERRED** - Proceeding with other development work. Will revisit when time permits. --- **Created**: November 14, 2025 **Last Updated**: November 14, 2025 **Assigned To**: TBD **Estimated Effort**: 2-4 hours for proper debugging and fix