Skip to content

spec(AST-103): itemKey and the reported key are a string or a number - #8592

Merged
cixzhang merged 2 commits into
mainfrom
spec/ast103-key-string-or-number
Oct 26, 2026
Merged

cixzhang merged 2 commits into
mainfrom
spec/ast103-key-string-or-number

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Record accuracy for spec:AST-103. FR1 says itemKey is "a string", but FR1 also says a data collection without its own identity uses Table's idKey, whose shape returns string | number, so onReorder's key can already be a number. This one-line change makes itemKey, and the key onReorder reports, a string or a number, matching Table's idKey.

No behavior or other requirement changes.

Writing rubric results

  • R1 present tense: pass. R2 research: none. R3 verification: FR1's existing row covers keys.
  • R4 rejected alternatives: none. R5 change references: none. R6 open questions: none.

@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 26, 2026 10:19pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 26, 2026, 10:38 PM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 122594d

@github-actions github-actions Bot added the spec-auto-merge Auto-merge was enabled by the spec owner gate label Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One wording fix is needed before this lands: FR1 now calls itemKey "a string or a number, the same as React keys", but React's Key type in this repository (@types/react 19.2.17) is string | number | bigint, so the sentence both allows and excludes bigint keys, and the open List implementation in #8139 already types itemKey as React's Key. Please drop "React keys and" (Table's idKey and Core's own Key type are both string | number), or name React's Key if bigint keys are intended; the new head will need a fresh /approve-spec. The widening itself is owner-approved and contradicts no other current record.

[Automated review]

Comment thread docs/specs/AST-103-reorderable/spec.md Outdated
Each item's key comes from the data,
never from React's `key`: List reads each `ListItem`'s `itemKey`, a string;
never from React's `key`: List reads each `ListItem`'s `itemKey`, a string or a number, the
same as React keys and Table's `idKey`, and `onReorder` reports that key as

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React's Key in this repository's @types/react (19.2.17) is string | number | bigint, so "the same as React keys" and "a string or a number" disagree about bigint, and #8139 already types itemKey as React's Key. Dropping "React keys and" keeps the type that Table's idKey and Core's own Key already share; naming React's Key instead would admit bigint.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec dfad545

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spec change looks ready to land: FR1 now types itemKey, and the key onReorder reports, as a string or a number, matching what Table's idKey returns, and the earlier wording problem with React keys is gone. The rewrite is owner-approved for this head and contradicts no other current record. One follow-up outside this pull request: the List implementation in #8139 types itemKey as React's Key, which also allows bigint, so it will need to narrow to string | number to match.

[Automated review]

@cixzhang
cixzhang merged commit b1a18b1 into main Oct 26, 2026
54 checks passed
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
…3 FR1 now says

meta#8592 changed FR1: List reads each ListItem's itemKey, a string or a
number, the shape Table's idKey returns, and onReorder reports that key as
given. The prop was a string only: it is now string | number (not React's
Key, which also takes a bigint). The test moves a number-keyed row and a
string-keyed row and checks each key comes back as given; a bigint key is
a type error. ListItem's doc and createReorderable's advice say the same.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 27, 2026
@github-actions
github-actions Bot deleted the spec/ast103-key-string-or-number branch October 27, 2026 06:22
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…string or a number

spec:AST-103 FR1 (meta#8592): an item's key is a string or a number, and a
reorderable object's keys default to that. The stories typed the key their
owner's onReorder receives as React's Key, which also allows a bigint, so
the object they made was a Reorderable<Key> that ListInput's reorderable
prop does not take: the Storybook typecheck failed at four uses.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
spec:AST-103 FR1 (meta#8592): an item's key is a string or a number, the shape
ListItem's itemKey and Table's idKey take. createReorderable constrained
its key type to React's Key, which also allows a bigint, so
createReorderable<bigint> type-checked though no item could ever report
such a key. The key type of the object, its options and its moves is now
string | number.

Failing-first: a @ts-expect-error on createReorderable<bigint> was unused
(TS2578) before this; core's tsc passes now.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
spec:AST-103 FR1 (meta#8592): an item's key is a string or a number, the shape
ListItem's itemKey and Table's idKey take. createReorderable constrained
its key type to React's Key, which also allows a bigint, so
createReorderable<bigint> type-checked though no item could ever report
such a key. The key type of the object, its options and its moves is now
string | number.

Failing-first: a @ts-expect-error on createReorderable<bigint> was unused
(TS2578) before this; core's tsc passes now.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…string or a number

spec:AST-103 FR1 (meta#8592): an item's key is a string or a number, and a
reorderable object's keys default to that. The stories typed the key their
owner's onReorder receives as React's Key, which also allows a bigint, so
the object they made was a Reorderable<Key> that ListInput's reorderable
prop does not take: the Storybook typecheck failed at four uses.

This branch was successfully deployed

1 active deployment
Preview — dfad5454 Deployed Oct 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. spec-auto-merge Auto-merge was enabled by the spec owner gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant