Context
Found during the v13.3 manual sweep on dev af81fc0f86. In examples/grid/covid, one click on the sortable # header empties the grid. That column's dataField is index, which is a real Integer model field. The console then shows TypeError: Cannot read properties of undefined for 'country', 'colspan', 'cases' and 'annotations.selected'. apps/covid and apps/sharedcovid declare the same index field.
The Problem
Neo.collection.Base#doSort sorts through a map whenever a sorter has useTransformValue, and Sorter defaults that to true (src/collection/Sorter.mjs:77). So the map path is the default for every property sort. Each mapped entry starts as {index}, the item's position, and then takes each sort property as a key (src/collection/Base.mjs:769–782). A sort property named index overwrites the position with the item's own value. The map back, items[el.index] (:805), then looks items up by field value instead of position. An out-of-range value yields undefined, and an in-range one yields the wrong item. The covid data never sets index, so every entry becomes undefined, and every later read of the collection throws.
The Architectural Reality
- The map is the "sorting with map" pattern cited at
:768. Its position key shares one namespace with the sort properties.
- The direct path (
mappedItems = items, when no sorter transforms) builds no helper object and is unaffected.
Store#doSort hydrates and then calls super.doSort, so Stores and plain Collections share the defect.
- Design authority: a sort reorders a collection and never changes its members. The collection's own
sort event reports items beside previousItems as the same set.
The Fix
Key the position with a Symbol, declared beside initialIndexSymbol and isSorted at the top of src/collection/Base.mjs, so no string property can collide with it.
Acceptance Criteria
Out of Scope
- A
sortable: false header that still sorts on click, #19801. That is how apps/covid reaches this defect through its non-sortable # column.
Related
#19007 (sorter ordering, closed) · #19652
Live latest-open sweep: the latest 20 open issues at 2026-10-16T11:18Z, no equivalent. A closed-issue search for sort, index and undefined found #19007 only (ordering, not membership).
A2A claim sweep: the latest 12 messages, through 11:17Z. The only grid claims are Emmy's #19794 and Ada's locked-arrow note, which #19798 covers.
MC sweep: "sorting by index field empties collection items undefined covid grid rows vanish", 5 results, no prior decision.
Own-assignment sweep: 5 open (#19798, #19766, #19765, #19652, #15000), none overlapping.
Origin Session ID: bb2e8968-a6d6-4ef7-a4ed-5ab3157b1ac8
Retrieval Hint: "collection doSort sorting with map index key collision sort property named index items undefined"
Context
Found during the v13.3 manual sweep on
devaf81fc0f86. Inexamples/grid/covid, one click on the sortable#header empties the grid. That column'sdataFieldisindex, which is a realIntegermodel field. The console then showsTypeError: Cannot read properties of undefinedfor'country','colspan','cases'and'annotations.selected'.apps/covidandapps/sharedcoviddeclare the sameindexfield.The Problem
Neo.collection.Base#doSortsorts through a map whenever a sorter hasuseTransformValue, andSorterdefaults that to true (src/collection/Sorter.mjs:77). So the map path is the default for every property sort. Each mapped entry starts as{index}, the item's position, and then takes each sort property as a key (src/collection/Base.mjs:769–782). A sort property namedindexoverwrites the position with the item's own value. The map back,items[el.index](:805), then looks items up by field value instead of position. An out-of-range value yieldsundefined, and an in-range one yields the wrong item. The covid data never setsindex, so every entry becomesundefined, and every later read of the collection throws.The Architectural Reality
:768. Its position key shares one namespace with the sort properties.mappedItems = items, when no sorter transforms) builds no helper object and is unaffected.Store#doSorthydrates and then callssuper.doSort, so Stores and plain Collections share the defect.sortevent reportsitemsbesidepreviousItemsas the same set.The Fix
Key the position with a Symbol, declared beside
initialIndexSymbolandisSortedat the top ofsrc/collection/Base.mjs, so no string property can collide with it.Acceptance Criteria
index(ASC, DESC, and as the second of two sorters) is ordered by that field and keeps every item. Red ondev.autoInitRecords: false). Its complex-field hydration runs beforesuper.doSortand only adds properties, so it never reaches the position key (Euclid's review note on #19802).examples/grid/covid: the#header sorts byindexand keeps every row.Out of Scope
sortable: falseheader that still sorts on click, #19801. That is howapps/covidreaches this defect through its non-sortable#column.Related
#19007 (sorter ordering, closed) · #19652
Live latest-open sweep: the latest 20 open issues at 2026-10-16T11:18Z, no equivalent. A closed-issue search for sort, index and undefined found #19007 only (ordering, not membership). A2A claim sweep: the latest 12 messages, through 11:17Z. The only grid claims are Emmy's #19794 and Ada's locked-arrow note, which #19798 covers. MC sweep: "sorting by index field empties collection items undefined covid grid rows vanish", 5 results, no prior decision. Own-assignment sweep: 5 open (#19798, #19766, #19765, #19652, #15000), none overlapping.
Origin Session ID: bb2e8968-a6d6-4ef7-a4ed-5ab3157b1ac8 Retrieval Hint: "collection doSort sorting with map index key collision sort property named index items undefined"