Skip to content

Commit 3fe8cc3

Browse files
authored
Merge pull request #13 from DDD-Community/develop
FEAT: mswClientProvider 플래그 변수 추가
2 parents 40f406a + ee08d23 commit 3fe8cc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mocks/mswClientProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ export default function MSWClientProvider({ children }: { children: React.ReactN
2121

2222
/** app/layout.tsx는 Next.js에서 서버에서 렌더링될 수도 있기 때문에, window가 없어서 MSW가 setupWorker()에서 터지는 경우가 있습니다. */
2323
/** 그래서 MSW가 실행될 준비가 된 다음에만 children을 렌더링하도록 하여 자식 컴포넌트에서 fetch 요청을 했을때 404가 뜨지 않도록 보장하였습니다. */
24-
return readyToUseMSW ? children : null;
24+
const shouldRender = readyToUseMSW || process.env.NODE_ENV === 'production';
25+
return shouldRender ? children : null;
2526
}

0 commit comments

Comments
 (0)