Only call useEffect on mounted

This commit is contained in:
redphx
2025-02-07 21:32:18 +07:00
parent 3c2549178b
commit 585ee82776
3 changed files with 3 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ export class PatcherUtils {
}
static injectUseEffect(str: string, index: number, group: 'Stream' | 'Script', eventName: string) {
const newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}));`;
const newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), []);`;
str = PatcherUtils.insertAt(str, index, newCode);
return str;