Skip to content

feat: per-instance reload + manual hibernate/wake from sidebar context menu#12

Open
Teamingzooper wants to merge 1 commit into
feat/sidebar-searchfrom
feat/sidebar-context-actions
Open

feat: per-instance reload + manual hibernate/wake from sidebar context menu#12
Teamingzooper wants to merge 1 commit into
feat/sidebar-searchfrom
feat/sidebar-context-actions

Conversation

@Teamingzooper

Copy link
Copy Markdown
Owner

Summary

Right-click any sidebar instance now exposes actions that operate on that instance rather than the active one. Pairs nicely with #10 (auto-hibernate) — once you have hibernation on, you can manually trigger it for a specific instance instead of waiting for the timer.

Branch base: `feat/sidebar-search` — seventh in the stack. Merge order: #6#7#8#9#10#11 → this.

What changes in the context menu

Item Before After
Reload Activated then reloaded the instance (jumped you to it) Reloads in place — no activation. Useful for refreshing a background tab.
Hibernate now n/a New. Appears below Mute when the hibernate feature is enabled AND the instance is not currently active. Frees its memory immediately.
Wake n/a New. Appears in place of Hibernate when the instance is asleep. Recreates the view in the background without jumping to it.

Architecture

Three new `ViewService` methods, all idempotent and safe-on-unknown-id:

  • `reloadInstance(id)` — `ensure()`s the view (waking if hibernated) then `webContents.reload()`.
  • `hibernateInstance(id)` — same teardown path as the periodic sweep, but triggered manually. Skipped if the instance is the active one or has no live view.
  • `wakeInstance(id)` — rebuilds a hibernated view in the background, without activating it.

Three matching IPC channels (`nexus:instances:reload`, `nexus:instances:hibernate`, `nexus:instances:wake`), Zod-validated input.

Renderer store gets matching actions with optimistic updates of the `hibernatedInstances` slice so the 💤 indicator flicks on/off immediately.

Test plan

  • `npm run typecheck` — clean
  • `npm run test` — 178/178 passing
  • `npm run build` — renderer + main both clean
  • Manual smoke: right-click a background instance, hit Reload. The instance reloads its page but you stay on whatever's active.
  • Manual smoke (after feat: auto-hibernate inactive instances to reclaim memory #10 is merged): enable hibernation in Settings → Performance. Right-click a background instance → "Hibernate now". The 💤 appears. Right-click again → "Wake". The 💤 clears and the view rebuilds.
  • Manual smoke: right-click the currently-active instance with hibernate on — should NOT show "Hibernate now" (active is never hibernated).

🤖 Generated with Claude Code

…t menu

Right-click on any sidebar instance now offers context-aware actions
that act on THAT instance, not just the active one.

Changes:
- New ViewService methods: reloadInstance(id), hibernateInstance(id),
  wakeInstance(id). All idempotent and safe-on-unknown-id.
  - reloadInstance: ensures the view exists (waking it if hibernated)
    and reloads. Works on background instances too.
  - hibernateInstance: same teardown path as the periodic sweep, but
    triggered manually. Skipped if the instance is the active one or
    has no live view.
  - wakeInstance: rebuilds a hibernated view in the background without
    activating it. Useful for "warming up" before a switch.
- Three new IPC channels (nexus:instances:reload,
  nexus:instances:hibernate, nexus:instances:wake), all with Zod-validated
  instanceId input. preload + nexus.d.ts updated.
- Renderer store gets matching actions with optimistic updates of the
  hibernatedInstances set.
- Sidebar context menu:
  - "Reload" now reloads in place (no forced activation), making it
    useful for refreshing background tabs.
  - "Hibernate now" appears below Mute when the hibernate feature is
    enabled AND the instance is not currently active.
  - "Wake" appears in place of Hibernate when the instance is asleep.

178/178 tests still pass, typecheck + build clean.
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.

2 participants