waveterm/frontend
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
..
app Add a mousedown handler to also signal user activity in the app (#2976) 2026-03-04 16:25:53 -08:00
builder Refactor ContextMenuModel to lazy singleton via getInstance() and update all call sites (#2920) 2026-02-23 13:42:02 -08:00
layout update eslint to v9 (and fix all eslint errors) (#2923) 2026-02-23 18:42:17 -08:00
preview Add virtualized flat-list TreeView component and preview sandbox (#2972) 2026-03-03 18:25:42 -08:00
types Add a mousedown handler to also signal user activity in the app (#2976) 2026-03-04 16:25:53 -08:00
util Add Onboarding Flows to Preview Server (#2960) 2026-03-02 11:06:01 -08:00
tailwindsetup.css New ConnMonitor to Track "Stalled" Connection State for SSH Conns (#2846) 2026-02-09 17:11:55 -08:00
wave.ts Remove unused frontend notification system and dev-only updater notification UI (#2929) 2026-02-24 12:49:13 -08:00