Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const percentFormatter = new Intl.NumberFormat('en', {
});

function change(decimal) {
if (Number === Infinity) {
if (decimal === Infinity) {
return 'New file';
}
if (decimal === -1) {
Expand Down
25 changes: 25 additions & 0 deletions packages/react/src/__tests__/ReactChildren-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,31 @@ describe('ReactChildren', () => {
});
});

it('does not throw on children without `_store`', async () => {
function ComponentRenderingFlattenedChildren({children}) {
return <div>{React.Children.toArray(children)}</div>;
}

const source = <div />;
const productionElement = {};
Object.entries(source).forEach(([key, value]) => {
if (key !== '_owner' && key !== '_store') {
productionElement[key] = value;
}
});
Object.freeze(productionElement);

const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(
<ComponentRenderingFlattenedChildren>
{productionElement}
</ComponentRenderingFlattenedChildren>,
);
});
});

it('should escape keys', () => {
const zero = <div key="1" />;
const one = <div key="1=::=2" />;
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/jsx/ReactJSXElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,9 @@ export function cloneAndReplaceKey(oldElement, newKey) {
);
if (__DEV__) {
// The cloned element should inherit the original element's key validation.
clonedElement._store.validated = oldElement._store.validated;
if (oldElement._store) {
clonedElement._store.validated = oldElement._store.validated;
}
}
return clonedElement;
}
Expand Down
Loading