Skip to content

fix(wineCtx): Prevent TypeError from non-atomic game.runtime access - #124

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/winectx-reactivity-race
Open

fix(wineCtx): Prevent TypeError from non-atomic game.runtime access#124
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/winectx-reactivity-race

Conversation

@sentry

@sentry sentry Bot commented Jul 15, 2026

Copy link
Copy Markdown

Summary

This PR addresses issue RUST-G, fixing a TypeError: undefined is not an object (evaluating 'game.runtime.runtime') originating in the wineCtx function. The error was caused by a reactivity race condition in a Svelte 5 reactive context, where game.runtime could re-evaluate to undefined between non-atomic accesses.

Changes

  • Cached the result of game?.runtime into a local variable (r) within the wineCtx function.
  • Modified wineCtx to use the cached r for both the null-check (!r) and the subsequent property access (r.runtime), ensuring atomic access.

Testing

  • cargo test -p corkscrew passes
  • npx svelte-check --threshold error passes
  • Manually tested with cargo tauri dev (if UI changes)

Notes

The root cause was a reactivity race condition specific to how Svelte 5 handles reactive objects (Proxies). Accessing game.runtime twice non-atomically allowed the runtime property to become undefined between the initial check and subsequent use, leading to the TypeError.

Fixes RUST-G

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

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.

0 participants