Skip to content

fix: Await definition loading in worker context before creating game#1177

Merged
braedonsaunders merged 1 commit into
mainfrom
claude/fix-worker-initialization-2c6YA
Jan 31, 2026
Merged

fix: Await definition loading in worker context before creating game#1177
braedonsaunders merged 1 commit into
mainfrom
claude/fix-worker-initialization-2c6YA

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

The worker runs in a separate JavaScript context from the main thread, so it has its own DefinitionRegistry singleton that needs to be initialized independently.

Previously, initializeDefinitions() was only called on the main thread, causing the worker's GameCore constructor to fire off an async bootstrapDefinitions() call that didn't complete before systems tried to access definitions.

This fix awaits initializeDefinitions() in the worker's 'init' message handler before creating WorkerGame, ensuring definitions are fully loaded in the worker context.

https://claude.ai/code/session_0123HA6ovqXT4Gk6EyLXoc3h

The worker runs in a separate JavaScript context from the main thread,
so it has its own DefinitionRegistry singleton that needs to be
initialized independently.

Previously, initializeDefinitions() was only called on the main thread,
causing the worker's GameCore constructor to fire off an async
bootstrapDefinitions() call that didn't complete before systems tried
to access definitions.

This fix awaits initializeDefinitions() in the worker's 'init' message
handler before creating WorkerGame, ensuring definitions are fully
loaded in the worker context.

https://claude.ai/code/session_0123HA6ovqXT4Gk6EyLXoc3h
@braedonsaunders braedonsaunders merged commit b2e54e5 into main Jan 31, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants