mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-24 09:18:27 +00:00
`mousedown` activity signaling was structured such that async telemetry
concerns leaked into event handling. This change moves fire-and-forget
behavior to the model boundary and keeps telemetry failures non-fatal.
- **`mousedown` handler path**
- `AppKeyHandlers` now calls `GlobalModel.getInstance().setIsActive()`
directly (no async wrapper in the handler).
- **`GlobalModel.setIsActive` structure**
- `setIsActive()` is now synchronous (`void`).
- Throttle logic remains unchanged.
- Electron telemetry call is executed via `util.fireAndForget(...)`
inside `setIsActive()`.
- **Telemetry error containment**
- `getApi().setIsActive()` is wrapped in `try/catch` inside the
fire-and-forget callback.
- Errors are logged with `console.log("setIsActive error", e)` and do
not bubble.
- **Focused coverage**
- Added `frontend/app/store/global-model.test.ts` for:
- fire-and-forget invocation + throttling behavior
- error logging/swallowing on rejected telemetry call
```ts
setIsActive(): void {
const now = Date.now();
if (now - this.lastSetIsActiveTs < GlobalModel.IsActiveThrottleMs) {
return;
}
this.lastSetIsActiveTs = now;
util.fireAndForget(async () => {
try {
await getApi().setIsActive();
} catch (e) {
console.log("setIsActive error", e);
}
});
}
```
<!-- START COPILOT CODING AGENT TIPS -->
---
🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
|
||
|---|---|---|
| .. | ||
| custom.d.ts | ||
| gotypes.d.ts | ||
| jsx.d.ts | ||
| media.d.ts | ||
| vite-env.d.ts | ||
| waveevent.d.ts | ||