Skip to content

Commit

Permalink
Fix ReactFresh-test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Mar 26, 2024
1 parent 02ee4f1 commit f9ac852
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/react-refresh/src/__tests__/ReactFresh-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ describe('ReactFresh', () => {
return Component;
}

function patchSync(version) {
const Component = version();
ReactFreshRuntime.performReactRefresh();
return Component;
}

function $RefreshReg$(type, id) {
ReactFreshRuntime.register(type, id);
}
Expand Down Expand Up @@ -2470,7 +2476,7 @@ describe('ReactFresh', () => {
expect(el.firstChild).toBe(null); // Offscreen content not flushed yet.

// Perform a hot update.
await patch(() => {
patchSync(() => {
function Hello() {
React.useLayoutEffect(() => {
Scheduler.log('Hello#layout');
Expand Down Expand Up @@ -2509,7 +2515,7 @@ describe('ReactFresh', () => {
expect(el.firstChild.style.color).toBe('red');

// Hot reload while we're offscreen.
await patch(() => {
patchSync(() => {
function Hello() {
React.useLayoutEffect(() => {
Scheduler.log('Hello#layout');
Expand Down

0 comments on commit f9ac852

Please sign in to comment.