fix: Critical data loss bug in variant editor - removed overly aggressive column skip logic
Problem: Variant editor was skipping ALL columns with headers starting with 'Property '
(e.g., 'Property 1'), which caused complete data loss during serialization.
When users entered data but didn't rename the default column header, serializeToJSON()
would skip the column entirely, returning an empty array [] to the database.
Fix: Only skip columns with truly empty names, not default 'Property X' names.
Users can now save data even if they haven't renamed column headers.
Files changed:
- wwwroot/js/variant-editor.js: Removed propertyName.startsWith('Property ') check
- Areas/Admin/Views/VariantCollections/Create.cshtml: Updated cache-busting to v=20251113d
- Areas/Admin/Views/VariantCollections/Edit.cshtml: Updated cache-busting to v=20251113d
This commit is contained in:
parent
35ebf58dca
commit
0dbc49ee89
@ -74,7 +74,7 @@
|
|||||||
<script src="~/lib/hammerjs/hammer.min.js?v=20251113c"></script>
|
<script src="~/lib/hammerjs/hammer.min.js?v=20251113c"></script>
|
||||||
|
|
||||||
<!-- Variant Editor Module -->
|
<!-- Variant Editor Module -->
|
||||||
<script src="~/js/variant-editor.js?v=20251113c"></script>
|
<script src="~/js/variant-editor.js?v=20251113d"></script>
|
||||||
|
|
||||||
<!-- Initialize Variant Editor -->
|
<!-- Initialize Variant Editor -->
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -85,7 +85,7 @@
|
|||||||
<script src="~/lib/hammerjs/hammer.min.js?v=20251113c"></script>
|
<script src="~/lib/hammerjs/hammer.min.js?v=20251113c"></script>
|
||||||
|
|
||||||
<!-- Variant Editor Module -->
|
<!-- Variant Editor Module -->
|
||||||
<script src="~/js/variant-editor.js?v=20251113c"></script>
|
<script src="~/js/variant-editor.js?v=20251113d"></script>
|
||||||
|
|
||||||
<!-- Initialize Variant Editor -->
|
<!-- Initialize Variant Editor -->
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -395,9 +395,9 @@ class VariantEditor {
|
|||||||
for (let col = 0; col < headers.length; col++) {
|
for (let col = 0; col < headers.length; col++) {
|
||||||
const propertyName = headers[col];
|
const propertyName = headers[col];
|
||||||
|
|
||||||
// Skip empty column names or default column names
|
// Skip only truly empty column names
|
||||||
if (!propertyName || propertyName.trim() === '' || propertyName.startsWith('Property ')) {
|
if (!propertyName || propertyName.trim() === '') {
|
||||||
console.log('Skipping column:', { colIndex: col, name: propertyName, reason: 'empty or default' });
|
console.log('Skipping column:', { colIndex: col, name: propertyName, reason: 'empty name' });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user