mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[fizz] Fix validateIterable call (#24166)
* fix validate iterable call * supports iterable * gate test by experimental
This commit is contained in:
@@ -2508,4 +2508,27 @@ describe('ReactDOMFizzServer', () => {
|
||||
<span>default</span>,
|
||||
]);
|
||||
});
|
||||
|
||||
// @gate experimental
|
||||
it('Supports iterable', async () => {
|
||||
const Immutable = require('immutable');
|
||||
|
||||
const mappedJSX = Immutable.fromJS([
|
||||
{name: 'a', value: 'a'},
|
||||
{name: 'b', value: 'b'},
|
||||
]).map(item => <li key={item.get('value')}>{item.get('name')}</li>);
|
||||
|
||||
await act(async () => {
|
||||
const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
|
||||
<ul>{mappedJSX}</ul>,
|
||||
);
|
||||
pipe(writable);
|
||||
});
|
||||
expect(getVisibleChildren(container)).toEqual(
|
||||
<ul>
|
||||
<li>a</li>
|
||||
<li>b</li>
|
||||
</ul>,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -1181,7 +1181,7 @@ function renderNodeDestructive(
|
||||
const iteratorFn = getIteratorFn(node);
|
||||
if (iteratorFn) {
|
||||
if (__DEV__) {
|
||||
validateIterable(node, iteratorFn());
|
||||
validateIterable(node, iteratorFn);
|
||||
}
|
||||
const iterator = iteratorFn.call(node);
|
||||
if (iterator) {
|
||||
|
||||
Reference in New Issue
Block a user