Repository navigation
Profiles tab: mark the launching or deleting profile after a remount - #142
Conversation
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
left a comment
There was a problem hiding this comment.
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.
| }) | ||
| window.vmm.vmWork().then(setVmWork) | ||
| const offWork = window.vmm.onVmWork(({ name, work }) => | ||
| window.vmm.vmWork().then((w) => { |
There was a problem hiding this comment.
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.
|
Fixed in d35b079. App remembers which VMs a typecheck, |
A21-devs
left a comment
There was a problem hiding this comment.
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.
Closes #137
Since #131 the Profiles tab follows the backend's work, but
vm:workonly 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.exclusivetakes the profile's tag for launch and delete.vm:worksends{ name, work, tag }.vmWork()now answers{ work, tags }(newVmWorkStatetype), so a window that reloads mid-launch knows the tag as well. The main side'sBackend.vmWork()used by the tray is unchanged.aria-busy.Testing
tests/profileSave.test.ts: a delete reports its tag throughonWorkandworkTags()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.