perf: cut ControlApp re-renders and lazy-load VFX packs
Move audio scrub/volume and brush drafts off root React ticks, coalesce overlay layout IPC, cache machine fingerprint and asset URLs, share one scene overlay host, and stop idle Pixi ticker. Also harden console against EPIPE on window load failures. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* В Electron (особенно после рестарта в dev) stdout/stderr часто уже закрыты.
|
||||
* Обычный `console.error` тогда даёт EPIPE и валит main process диалогом Uncaught Exception.
|
||||
*/
|
||||
|
||||
function isBrokenPipe(err: unknown): boolean {
|
||||
const code = (err as NodeJS.ErrnoException | undefined)?.code;
|
||||
return code === 'EPIPE' || code === 'ERR_STREAM_DESTROYED';
|
||||
}
|
||||
|
||||
export function installStdoutEpipeGuards(): void {
|
||||
for (const stream of [process.stdout, process.stderr]) {
|
||||
stream?.on('error', (err: NodeJS.ErrnoException) => {
|
||||
if (isBrokenPipe(err)) return;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function safeConsoleError(...args: unknown[]): void {
|
||||
try {
|
||||
console.error(...args);
|
||||
} catch (err) {
|
||||
if (isBrokenPipe(err)) return;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user