Skip to content

Commit

Permalink
golf
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 1, 2023
1 parent 71d0151 commit cb0eeec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 35 deletions.
4 changes: 1 addition & 3 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ export function getDomSibling(vnode, childIndex) {
// Since updateParentDomPointers keeps _dom pointer correct,
// we can rely on _dom to tell us if this subtree contains a
// rendered DOM node, and what the first rendered DOM node is
return typeof sibling.type == 'function'
? sibling._nextDom || sibling._dom
: sibling._dom;
return sibling._nextDom || sibling._dom;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/diff/children.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export function diffChildren(
(matchingIndex !== skewedIndex ||
oldVNode._children === childVNode._children)
) {
console.log('reorder');
oldDom = reorderChildren(childVNode, oldDom, parentDom);
} else if (
typeof childVNode.type != 'function' &&
Expand Down
31 changes: 0 additions & 31 deletions test/browser/fragments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,37 +677,6 @@ describe('Fragment', () => {
);
});

it('should preserver order 2', () => {
let set;
class Foo extends Component {
constructor(props) {
super(props);
this.state = { isLoading: true, data: null };
set = this.setState.bind(this);
}
render(props, { isLoading, data }) {
return (
<div>
<div>HEADER</div>
{isLoading ? <div>Loading...</div> : null}
{data ? <div>Content: {data}</div> : null}
</div>
);
}
}

render(<Foo />, scratch);
expect(scratch.firstChild.innerHTML).to.equal(
'<div>HEADER</div><div>Loading...</div>'
);

set({ isLoading: false, data: 2 });
rerender();
expect(scratch.firstChild.innerHTML).to.equal(
'<div>HEADER</div><div>Content: 2</div>'
);
});

it('should preserve state with reordering in multiple levels', () => {
function Foo({ condition }) {
return condition ? (
Expand Down

0 comments on commit cb0eeec

Please sign in to comment.