Skip to content

Profiles tab: mark the launching or deleting profile after a remount - #142

Merged
A21-devs merged 4 commits into
mainfrom
feat/profile-work-tag
Dec 3, 2026
Merged

A21-devs merged 4 commits into
mainfrom
feat/profile-work-tag

Conversation

@A21-devs

@A21-devs A21-devs commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Closes #137

Since #131 the Profiles tab follows the backend's work, but vm:work only said what kind of work it was. After switching to another VM and back during a launch or a delete, every row just looked disabled.

  • Profiles.exclusive takes the profile's tag for launch and delete. vm:work sends { name, work, tag }.
  • vmWork() now answers { work, tags } (new VmWorkState type), so a window that reloads mid-launch knows the tag as well. The main side's Backend.vmWork() used by the tray is unchanged.
  • App keeps the tags next to the work and passes the current VM's to the Profiles tab through VmDetail.
  • In the tab, a row shows Launching… on its button or Deleting… under its name, whether this tab started it or not. The hint names the profile ("Launching profile "tools set up" on Kali. Wait for it to finish."). Rows being worked on get aria-busy.
  • A save has no tag: its profile doesn't exist until the save ends, so the Save button's "Saving…" stays as it was.
  • mockApi runs launch and delete as work with a tag and a couple of seconds' delay, so it can be tried in dev:web.

Testing

  • tests/profileSave.test.ts: a delete reports its tag through onWork and workTags() until it ends; the existing save test now also checks a save has no tag.
  • npm run typecheck, npm run build, npm test (150 passed). One full run had a single failure I couldn't reproduce in nine reruns and didn't catch the name of.
  • I didn't get to check it in dev:web in the browser this time, starting the dev server was declined in this session. The rendering change is small (a label and a line per row), but it hasn't been looked at.

vm:work only carried the kind of work, so after the Profiles tab was
remounted it couldn't tell which profile was launching or being
deleted. Profiles.exclusive now takes the tag for those two, vm:work
sends it, and vmWork() answers { work, tags } so a reloaded window
knows too. A save has no tag, its profile doesn't exist yet.
App keeps the tag from vm:work next to the work and hands it to the
Profiles tab. A row shows Launching... or Deleting... whether this tab
started it or not, and the hint names the profile. Rows being worked
on get aria-busy.
Both report vm:work with the tag and take a couple of seconds, so the
remount case can be tried in dev:web by switching VMs mid-launch.
@A21-devs A21-devs added enhancement New feature or request ui labels Dec 3, 2026

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff. The tag plumbing is consistent from exclusive through vm:work, App and VmDetail to the rows, the tray's Backend.vmWork() keeps its old shape, and the tag is cleared in the same finally as the work. One ordering problem, older than this PR but it now covers the tags too.

Comment thread src/renderer/src/App.tsx
})
window.vmm.vmWork().then(setVmWork)
const offWork = window.vmm.onVmWork(({ name, work }) =>
window.vmm.vmWork().then((w) => {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vmWork() answer replaces the whole map whenever it arrives. If a vm:work event comes in between the request and the answer (a launch ending right as the window loads), the answer is the older state and puts the finished work and its tag back. Nothing clears it until that VM's next work, so the tab stays disabled with a stale "Launching…". The snapshot should only fill in VMs no event has reported yet.

@A21-devs

A21-devs commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

Fixed in d35b079. App remembers which VMs a vm:work event has reported since mount, and withSnapshot in util.ts applies the vmWork() answer only to the other VMs, for both the work and the tags. New tests/workSnapshot.test.ts covers no event first, an end reported before the answer, and newer work on one VM next to snapshot work on another.

typecheck, npm test (153 passed), build.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass. The ordering is fixed: the event handler adds to reported before its own state update, so whichever order React runs the two updaters in, the answer's updater sees the event's VM as reported and keeps what the event left (including a removed entry). An answer that comes first goes in whole, as before. Both maps use the same set, so work and tag can't disagree. The tests match the three cases. Good to go.

App asked for the work once and replaced the whole map when the answer
came. A vm:work event in between (a launch ending as the window loads)
is newer than that answer, and the answer put the finished work and its
tag back, which left the Profiles tab disabled. withSnapshot keeps what
events reported and only fills in the other VMs from the answer.
@A21-devs
A21-devs merged commit dc6fb98 into main Dec 3, 2026
1 check passed
@A21-devs
A21-devs deleted the feat/profile-work-tag branch December 3, 2026 18:26
@A21-devs A21-devs mentioned this pull request Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profiles tab: say which profile is launching or being deleted after a remount

1 participant