Skip to content

refactor: Adopt 'internalId' for Stable DOM Keying (List & Data Views) #9071

@tobiu

Description

@tobiu

Context:
We have implemented a stable internalId (e.g., neo-record-1) for all store items via #9070.
Currently, Neo.list.Base and data views (Gallery, Helix) use the record's primary key (keyProperty) to generate DOM IDs (e.g., view__100).

Problem:

  1. Phantom Records: New records (id: null) cause DOM ID collisions.
  2. Mutability: Saving a record changes its ID (-1 -> 100), forcing a full DOM re-render.
  3. Security: Exposes database IDs in the DOM.

Task:
Update the base classes for Lists and Data Views to support using internalId for DOM keying.

Requirements:

  1. Opt-in Config: Add useInternalId: true (defaulting to false initially, or true if we are confident) to Neo.list.Base and Neo.component.Gallery / Helix.
  2. Implementation:
    • Update getItemId and item creation logic to use store.getInternalId(record) when the config is enabled.
    • Ensure selection models (ListModel, GalleryModel) respect this switch (comparing internal IDs vs record IDs).
  3. Verification: Test with CRUD scenarios (phantom records) and verify selection stability.

Scope:

  • src/list/Base.mjs
  • src/component/Gallery.mjs
  • src/component/Helix.mjs
  • Related Selection Models

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions