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
blockedBy[]
blocking[]
closedAtMar 11, 2026, 3:30 PM

Fix Grid Pooling DOM thrashing and Collection internalId lookup

Closed v12.1.0 bugaicoregrid
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 added the bug label on Mar 11, 2026, 2:27 PM
tobiu added the ai label on Mar 11, 2026, 2:27 PM
tobiu added the core label on Mar 11, 2026, 2:27 PM
tobiu added the grid label on Mar 11, 2026, 2:27 PM
tobiu referenced in commit 07f6da0 - "fix(grid): Prevent DOM thrashing and stabilize tests (#9442)" on Mar 11, 2026, 2:28 PM
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.

tobiu referenced in commit a48d756 - "fix(data): Preserve internalId in RecordFactory (#9442)" on Mar 11, 2026, 2:59 PM
tobiu closed this issue on Mar 11, 2026, 3:30 PM
tobiu assigned to @tobiu on Mar 11, 2026, 3:30 PM