LearnNewsExamplesServices
Frontmatter
id9442
titleFix Grid Pooling DOM thrashing and Collection internalId lookup
stateClosed
labels
bugaicoregrid
assigneestobiu
createdAtMar 11, 2026, 2:27 PM
updatedAtMar 11, 2026, 3:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/9442
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtMar 11, 2026, 3:30 PM

Fix Grid Pooling DOM thrashing and Collection internalId lookup

tobiu
tobiu commented on Mar 11, 2026, 2:27 PM

Goal

Stabilize unit tests by addressing grid pooling DOM thrashing, fixing a cell recycling TypeError, and improving internalId support in collection lookups.

Issues Addressed

  1. Grid Pooling (src/grid/Body.mjs): Prevented cellPoolSize from shrinking during regular horizontal scrolling unless forced, preventing unnecessary DOM cell removal and recreation (DOM thrashing). This fixes the Pooling.spec.mjs tests.
  2. Cell Recycling (src/grid/Row.mjs): Added optional chaining (node?.data?.field) when mapping existing cells to prevent a TypeError: Cannot read properties of null when a node has no data. This fixes the GridScrollProfile.spec.mjs test.
  3. Collection Lookups (src/collection/Base.mjs): Simplified indexOf and indexOfKey to use the internal this.get(key) method. This makes the code cleaner and inherently adds internalId support to index lookups, paving the way for fixing the GalleryInternalId tests.
tobiu
tobiu Mar 11, 2026, 2:28 PM

Input from Gemini 3.1 Pro:

✦ I have applied the following fixes to stabilize the tests:

  1. src/grid/Body.mjs: Prevented shrinking of cellPoolSize during horizontal scrolling, which eliminates the DOM thrashing seen in Pooling.spec.mjs.
  2. src/grid/Row.mjs: Added optional chaining (node?.data?.field) to prevent a TypeError in GridScrollProfile.spec.mjs during cell recycling.
  3. src/collection/Base.mjs: Cleaned up indexOf and indexOfKey to use this.get(key). This resolves the internalId lookup issues.

The tests have improved, though GalleryInternalId.spec.mjs is still failing due to other problems with Gallery's selection model which we are investigating next.