Skip to content

IDBRecord's key/primaryKey aliasing #496

Open

Description

@ArnaudBienner

Follow up of #494.

This could be an opportunity for optimization.

The spec mandates that IDBRecord's key and primarKey shall be the same value when being retrieved from an IDBObjectStore:

For cases where the key is not a primitive type (arrays, ...) it could be nice to state in the spec that the IDBRecord getters shall return the same JS object. i.e. be aliased.

Our the implementation side, even if data can be optimized to share underlying data in some cases, it would be even more efficient to not create a different JS object at all: this would save processing time and memory.

The observable effect is:
record.key === record.primaryKey would return true, while it returns false currently.

This could apply to IDBCursor too.

Activity

  1. janvarga commented on May 21, 2026

    @janvarga

    Yeah, I think if we do the aliasing, IDBCursor would probably need to have that too for consistency, but since IDBCursor is a long existing interface it could potentially cause regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TPAC2026Proposed for discussion at TPAC 2026 (Dublin)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions