Skip to content

Commit e14e5c0

Browse files
committed
Address feedback
1 parent b275a80 commit e14e5c0

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ function useEvent(event: any): any {
262262
hookLog.push({primitive: 'Event', stackError: new Error(), value: event});
263263
return {
264264
clear: noOp,
265-
listen: noOp,
266-
unlisten: noOp,
265+
setListener: noOp,
267266
};
268267
}
269268

packages/react-dom/src/events/__tests__/DOMModernPluginEventSystem-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ describe('DOMModernPluginEventSystem', () => {
10671067
ReactDOM.render(<Test />, container);
10681068
ReactDOM.render(<Test />, container);
10691069
expect(listenerMaps.length).toEqual(2);
1070-
expect(listenerMaps[1]).toEqual(listenerMaps[1]);
1070+
expect(listenerMaps[0]).toEqual(listenerMaps[1]);
10711071
});
10721072
});
10731073
});

packages/react-reconciler/src/ReactFiberHooks.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,9 @@ function mountEventListener(event: ReactListenerEvent): ReactListenerMap {
13941394
},
13951395
};
13961396
// In order to clear up upon the hook unmounting,
1397-
/// we ensure we push an effect that handles the use-case.
1397+
// we ensure we set the effecrt tag so that we visit
1398+
// this effect in the commit phase, so we can handle
1399+
// clean-up accordingly.
13981400
currentlyRenderingFiber.effectTag |= UpdateEffect;
13991401
pushEffect(NoHookEffect, noOpMount, clear, null);
14001402
hook.memoizedState = [reactListenerMap, event, clear];
@@ -1435,7 +1437,9 @@ function updateEventListener(event: ReactListenerEvent): ReactListenerMap {
14351437
}
14361438
}
14371439
// In order to clear up upon the hook unmounting,
1438-
/// we ensure we push an effect that handles the use-case.
1440+
// we ensure we set the effecrt tag so that we visit
1441+
// this effect in the commit phase, so we can handle
1442+
// clean-up accordingly.
14391443
currentlyRenderingFiber.effectTag |= UpdateEffect;
14401444
pushEffect(NoHookEffect, noOpMount, clear, null);
14411445
return reactListenerMap;

0 commit comments

Comments
 (0)