Skip to content

Commit f9ac852

Browse files
committed
Fix ReactFresh-test.js
1 parent 02ee4f1 commit f9ac852

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/react-refresh/src/__tests__/ReactFresh-test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ describe('ReactFresh', () => {
7979
return Component;
8080
}
8181

82+
function patchSync(version) {
83+
const Component = version();
84+
ReactFreshRuntime.performReactRefresh();
85+
return Component;
86+
}
87+
8288
function $RefreshReg$(type, id) {
8389
ReactFreshRuntime.register(type, id);
8490
}
@@ -2470,7 +2476,7 @@ describe('ReactFresh', () => {
24702476
expect(el.firstChild).toBe(null); // Offscreen content not flushed yet.
24712477

24722478
// Perform a hot update.
2473-
await patch(() => {
2479+
patchSync(() => {
24742480
function Hello() {
24752481
React.useLayoutEffect(() => {
24762482
Scheduler.log('Hello#layout');
@@ -2509,7 +2515,7 @@ describe('ReactFresh', () => {
25092515
expect(el.firstChild.style.color).toBe('red');
25102516

25112517
// Hot reload while we're offscreen.
2512-
await patch(() => {
2518+
patchSync(() => {
25132519
function Hello() {
25142520
React.useLayoutEffect(() => {
25152521
Scheduler.log('Hello#layout');

0 commit comments

Comments
 (0)