Skip to content

Commit 4add090

Browse files
committed
Fix window.React
1 parent 10b6ffc commit 4add090

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

packages/test/page-object/src/globals/testHelpers/createRunHookActivityMiddleware.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
const { createElement, memo, useRef } = React;
2-
3-
const RunHook = memo(({ fn, resolve }) => {
4-
const numCalledRef = useRef(0);
1+
const RunHook = ({ fn, resolve }) => {
2+
const numCalledRef = window.React.useRef(0);
53

64
resolve(fn(window.WebChat.hooks, numCalledRef.current++));
75

86
return false;
9-
});
7+
};
108

119
function createRunHookActivityMiddleware() {
1210
return () =>
1311
next =>
1412
({ activity, ...others }) => {
1513
if (activity.type === 'event' && activity.name === '__RUN_HOOK') {
16-
return () => !activity.ref.count++ && createElement(RunHook, activity.value);
14+
return () => !activity.ref.count++ && window.React.createElement(RunHook, activity.value);
1715
}
1816

1917
return next({ activity, ...others });

0 commit comments

Comments
 (0)