waveterm/frontend/types
Copilot 0ab26ef947
Add a mousedown handler to also signal user activity in the app (#2976)
`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>
2026-03-04 16:25:53 -08:00
..
custom.d.ts Add a mousedown handler to also signal user activity in the app (#2976) 2026-03-04 16:25:53 -08:00
gotypes.d.ts Remove mock-heavy OSC52 Vitest coverage (#2975) 2026-03-04 16:24:42 -08:00
jsx.d.ts migrate to react 19 (#2272) 2025-08-25 21:17:15 -07:00
media.d.ts UI only preview server (+ deployments) (#2919) 2026-02-23 12:48:28 -08:00
vite-env.d.ts New AIPanel (#2370) 2025-10-07 13:32:10 -07:00
waveevent.d.ts Generate WaveEvent as a typed discriminated union with explicit null payloads for no-data events (#2899) 2026-02-20 17:04:03 -08:00