Repository navigation
Description
Reproduction
Compile an authored Octane component with this native array map.
export function List({ rows }) @{
<ul>{rows.map(row => <li key={row.id} data-marker={row.read()} />)}</ul>
}
Use a fresh root and these props, then update it with rows.toReversed().
let marker = '-';
const rows = ['a', 'b'].map(id => ({
get id() { marker = id; return id; },
read() { return marker; },
}));Observed
In production client rendering on 6cdbc952c, the expression callback mounts with data-marker values a, b, then updates to a, a after reversal. The equivalent row => { return <li ... />; } callback updates to b, a.
The native keyed path probes keys before rendering rows and can read each key more than once on reorder. The original callback reads each key and then its prop before advancing to the next row.
Expected
Preserve the native map callback's observable cross-row evaluation order. This is independent of whether the key is before or after sibling attributes within one callback, as tracked in #2457.
Ordinary-array reproduction without explicit calls
On the core tree at 5041e23b44c59a828e68ee039d4ef8da0ba6ba19, production compilation still changes evaluation order when an inline JSX .map callback reads getters or implicitly coerces an object. The array is dense, uses its realm’s ordinary Array.prototype.map, and has no custom array method, species, or Proxy.
export function List({ rows }) @{
<ul>{rows.map((row) => <li key={row.id} data-marker={row.marker} />)}</ul>
}
let marker = '';
const rows = ['a', 'b'].map((id) => ({
get id() { marker = id; return id; },
get marker() { return marker; },
}));Mount with rows and synchronously update with [...rows].reverse(). The compiled inline callback yields data-marker values a, a. Changing only the callback to (row) => { return <li key={row.id} data-marker={row.marker} />; } retains authored .map dispatch and yields b, a. Both paths reuse the same keyed DOM nodes. With a pure data key, data-marker={'' + row} also reproduces the issue. Give each row a Symbol.toPrimitive that returns the incremented shared counter as a string and reset the counter immediately before the reorder. The inline callback yields 2, 1, while the retained callback yields 1, 2.
The production SSR difference can be observed independently with an ordinal key and no user-defined key lookup.
function Child({ value }) {
if (value === 0) throw Error('first child');
return <li />;
}
export function List({ rows }) @{
<ul>{rows.map((row, i) => <Child key={i} value={row.label} />)}</ul>
}
const rows = [
{ get label() { return 0; } },
{ get label() { throw Error('second callback'); } },
];renderToString(List, { rows }) throws first child on the fused path and second callback when the same callback is written as a block body. The latter completes the .map callback phase before rendering a child. The same ordering mismatch occurs with value={'' + row} and a throwing Symbol.toPrimitive on the second row.
Activity
domgan-oai commentedon Nov 13, 2026
The evaluation order also changes during parameter binding. This fixture uses an ordinary array and has no getter, call or coercion in the JSX callback body.
On
2e135078c3961321d0f435a5c165a48342d6a9d3, production Octane client and SSR both reportfirst child. Change the callback to([id, label]) => { return <Child key={id} label={label} />; }to retain ordinary map evaluation. Both reportsecond iterator, matching production React. The original map finishes binding each callback's arguments before rendering its first child. The fused path renders a child between parameter bindings.