Skip to content

Commit c791c0a

Browse files
committed
fix
1 parent 2491d5d commit c791c0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/components/Preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function Preview({ code, device, appState, fixBug }: Props) {
3737
</script>
3838
`;
3939
let content = '';
40-
if (appState === AppState.CODE_READY) {
40+
if (appState === AppState.CODE_READY && throttledCode) {
4141
var patternHead = /<title[^>]*>((.|[\n\r])*)<\/title>/im; //匹配header
4242
const headMatch = throttledCode.match(patternHead);
4343
if (headMatch) {
@@ -53,7 +53,7 @@ function Preview({ code, device, appState, fixBug }: Props) {
5353
}
5454

5555

56-
}, [throttledCode]);
56+
}, [throttledCode, AppState]);
5757

5858
useEffect(() => {
5959
const messageHandler = (e: any) => {

0 commit comments

Comments
 (0)