Skip to content

Commit

Permalink
optim
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 3, 2022
1 parent 674d274 commit 1aad6d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions hooks/src/index.js
Expand Up @@ -27,17 +27,19 @@ const RAF_TIMEOUT = 100;
let prevRaf;

options._diff = vnode => {
if (vnode.type === Fragment) {
// Skip so we don't have to ensure wrapping fragments in RTS and prepass
vnode._mask = '';
} else if (typeof vnode.type === 'function' && !vnode._mask) {
if (
typeof vnode.type === 'function' &&
!vnode._mask &&
vnode.type !== Fragment
) {
vnode._mask =
(vnode._parent && vnode._parent._mask ? vnode._parent._mask : '') +
(vnode._parent && vnode._parent._children
? vnode._parent._children.indexOf(vnode)
: 0);
} else {
vnode._mask = vnode._parent._mask;
} else if (!vnode._mask) {
vnode._mask =
vnode._parent && vnode._parent._mask ? vnode._parent._mask : '';
}

currentComponent = null;
Expand Down
2 changes: 1 addition & 1 deletion hooks/test/browser/useId.test.js
Expand Up @@ -126,7 +126,7 @@ describe('useId', () => {
set(true);
rerender();
expect(scratch.innerHTML).to.equal(
'<div id="P481"><div><span id="P476641">h</span><span id="P15671">h</span></div></div>'
'<div id="P481"><div><span id="P476641">h</span><span id="P486251">h</span></div></div>'
);
});
});

0 comments on commit 1aad6d8

Please sign in to comment.