Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix behave graph crashing servers
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Aug 31, 2023
1 parent 0c0e717 commit 820005b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/engine/src/behave-graph/functions/useGraphRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const useGraphRunner = ({

engine.executeAllSync()

let timeout: number
let timeout: NodeJS.Timeout

const eventEmitter = registry.dependencies?.ILifecycleEventEmitter as ILifecycleEventEmitter

Expand All @@ -90,7 +90,7 @@ export const useGraphRunner = ({
// eslint-disable-next-line no-await-in-loop
await engine.executeAllAsync(500)

timeout = window.setTimeout(onTick, 50)
timeout = setTimeout(onTick, 50)
}

;(async () => {
Expand All @@ -105,7 +105,7 @@ export const useGraphRunner = ({
})() // start up

return () => {
window.clearTimeout(timeout)
clearTimeout(timeout)
}
}, [engine, registry.dependencies?.ILifecycleEventEmitter, run])

Expand Down
1 change: 1 addition & 0 deletions packages/engine/src/scene/classes/Water.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class Water extends Mesh {
}

setupRenderTarget() {
if (typeof window === 'undefined') return
// Target for computing the water refraction
this.refractionRT = new WebGLRenderTarget(window.innerWidth, window.innerHeight)
}
Expand Down

0 comments on commit 820005b

Please sign in to comment.