Skip to content

refactor(List): write the reorder refs at commit, not in render - #10804

Closed
vjeux wants to merge 1 commit into
meta:mainfrom
vjeux:fix/list-reorder-refs-at-commit
Closed

vjeux wants to merge 1 commit into
meta:mainfrom
vjeux:fix/list-reorder-refs-at-commit

Conversation

@vjeux

@vjeux vjeux commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

The List reorder copied two values into refs during render: the session's list getter, and the mode hint's layer handle. A render React discards would leave its values there. No failure is reachable today, but the write breaks the render-purity rule, and a future caller could make it real.

Intended invariant

Change

Each ref is now written in a one-line layout effect, with a note naming what it syncs. The layer handle's effect comes before the hint effect that reads it, so that effect still reads the committed handle.

Evidence

  • Failure before the change: none reachable. Every in-repo caller passes a getter over a stable ref, and the layer handle's methods keep their identity across renders.
  • Success after the change, at e452200: the scan for render-time ref writes finds none in these two files.
  • Product/runtime behavior verified unchanged: the List, ListInput and TransferList unit tests pass, and so do the reorder browser specs in both engines.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

All runs below are at this PR's tree: head e452200, the same tree as 289f247, where they ran.

File Ref Written now Why no failure is reachable
listReorderContext.ts getListRef Layout effect List passes () => listRef.current, so every render's getter returns the same element.
listReorderEngine.tsx layerRef Layout effect, before the hint effect that reads it useLayer memoizes its handle, and ref, show and hide keep their identity.
  • pnpm exec vitest run packages/core/src/List packages/lab/src/ListInput packages/lab/src/TransferList --project ui: 12 files, 276 tests pass.
  • List reorder and divider interaction specs: Chromium 56 passed; WebKit in the CI-profile container 38 passed, 18 skipped.
  • TransferList reorder a11y spec, Chromium: 6 passed.
  • @astryxdesign/core typecheck: 0 errors. ESLint and Prettier on the changed files: clean.

The reorder session's list getter and the mode hint's layer handle were
copied into refs during render. Each is now written in a one-line
layout effect, so a render React discards leaves nothing behind. No
failure is reachable today: every getter reads a stable ref, and the
layer's methods keep their identity.
@vercel

vercel Bot commented Nov 9, 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 Nov 9, 2026 2:58pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot

astracat-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 9, 2026, 3:07 PM UTC

@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.

Approved pending CI: CI has not run on this head yet.

Moving the reorder session's list getter and the mode hint's layer handle into one-line layout effects changes no behavior, and the List, ListInput and TransferList unit tests and the core typecheck pass on this head.

Next step: mark the pull request ready for review, then a maintainer adds the ci:run label because the branch is in a fork; the label takes effect on the next push or a close and reopen.

[Automated review]

@vjeux

vjeux commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Closed per the spec owners: folded into the next List PR as a conformance tidy.

This branch was successfully deployed

1 active deployment
Preview — e4522003 Deployed Nov 9, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant