Skip to content

Conversation

@namastex888
Copy link

Summary

Fix Tauri event listeners not receiving events in ClaudeCodeSession component.

Problem

The event listeners were silently falling back to DOM events instead of Tauri events because:

  • require() fails in ES module builds (caught and ignored by try/catch)
  • Environment check was evaluated at module load time before Tauri injects globals

Solution

  • Use ES module import: import { listen as tauriListen } from "@tauri-apps/api/event"
  • Check environment at runtime (function) instead of module load time (static value)

Changes

  • 1 file changed: src/components/ClaudeCodeSession.tsx
  • 14 insertions, 15 deletions

Testing

  • Verified events now received with using Tauri: true in console
  • Messages display correctly in UI after fix

The event listeners were silently falling back to DOM events instead of
Tauri events because require() fails in ES module builds and the
environment check was evaluated at module load time.

- Use ES module import instead of require()
- Check environment at runtime (function) instead of module load (static)
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.

1 participant