Skip to content

fix(hub): wait for the observed app state after open and close requests - #100

Merged
egdev6 merged 2 commits into
mainfrom
fix/hub-app-action-pending
Nov 25, 2026
Merged

egdev6 merged 2 commits into
mainfrom
fix/hub-app-action-pending

Conversation

@egdev6

@egdev6 egdev6 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Linked issue

None. The maintainer found this bug while using the hub on Windows, and no issue was opened.

Type of change

  • type:bug
  • type:feature
  • type:docs
  • type:refactor
  • type:breaking-change
  • type:chore
  • type:test

Summary

When you opened or closed an installed app from My apps, its card briefly went back to the old state and the list jumped. There were two causes:

  • refreshApps cleared every installation observation before it rescanned. Every card became "unknown", dropped out of the installed list, then came back.
  • The global actionBusy flag was cleared as soon as the native command resolved. A resolved command only means the request was accepted, and no event fires when a process starts or exits.

Now each app keeps an Opening… or Closing… state, with the DS Spinner, until a rescan observes the change. Closing an app also collapses its expanded row.

Changes

Area Change
apps/hub/src/App.tsx Rescans keep the last observation on screen. A failed scan still falls back to unknown.
apps/hub/src/App.tsx Per-app pending state replaces the global actionBusy, so only the affected app's controls are disabled. While a request waits, the hub rescans every 1.5 s.
apps/hub/src/App.tsx The pending state ends when the observed state settles, when the request fails, when a close returns stillRunning, when the running state cannot be observed, or after 15 s with a warning. A response from a request that a newer one replaced is ignored.
apps/hub/src/App.tsx The header close action and the inner Close button both collapse the expanded row.
apps/hub/src/local-apps/view.tsx, apps/hub/src/style.css Local app notices sit in a container with the same spacing as between cards.
apps/hub/src/i18n/messages.json New keys appControl.opening, appControl.closing and appControl.confirmTimeout, in Spanish and English.
apps/hub/src/App.test.tsx 8 new tests. 7 failed on the previous code; the open-failure test passed already and stays as a regression guard.

Test evidence

Run from apps/hub unless noted:

  • npm test: 44 files, 602 tests passed.
  • npx tsc --noEmit -p .: clean.
  • npx biome check on the touched files: no new warnings. The noNonNullAssertion and noImportantStyles warnings were already there.
  • npm run ds:doctor: 0 errors, 0 warnings. npm run test:ds-adoption: 8 passed.
  • An independent verification pass reran these checks and the new tests against the base commit. It passed and flagged one race, a late response from a replaced request. That race is now fixed and covered by a test.
  • Manual check on Windows with a native debug build (cargo.exe build) served by Vite: the maintainer confirmed the open and close flow, then asked for the notice spacing and the row collapse included here.

Risks and follow-ups

  • refreshApps is shared with window focus, install completion, Refresh apps and registry-departure rescans. These now keep stale data on screen during a scan instead of blanking it. Scan ordering is still guarded by scanId.
  • A catalog change during a pending action resets installations to unknown, which can settle a pending close early. This is rare and is left as is.
  • The success notice above the tabs still shifts the content slightly when it appears. Showing it only for errors and warnings would be a behavior change, so it is left for a separate decision.
  • Native Windows scripts/check.sh --windows was not run, because no Rust code changed.

Review notes

  • Start with pendingSettled and startPending/endPending in App.tsx.
  • To verify: open and close an official app on Windows. The card should show Opening… or Closing… and then the new state, with no flicker back to the old one. Refresh apps should keep the cards in place.

AI assistance

el Gentleman (Claude) diagnosed the cause, wrote the code and tests, and ran the checks. The maintainer tested the result on Windows and owns the final decision.

Rescans no longer blank the installed list, and each app now shows an opening or closing state until a rescan confirms the change, the request fails, or a 15 s timeout warns that it could not be confirmed.
…tices

Both the header close action and the inner close button collapse the expanded row. Local app notices keep the card spacing below them.
@egdev6 egdev6 added the type:bug Something is not working as expected label Nov 25, 2026
@egdev6
egdev6 merged commit bc356e3 into main Nov 25, 2026
4 checks passed
@egdev6
egdev6 deleted the fix/hub-app-action-pending branch November 25, 2026 10:57
@egdev6 egdev6 mentioned this pull request Nov 25, 2026
1 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something is not working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant