diff --git a/packages/app/src/settings/providers/extensions.tsx b/packages/app/src/settings/providers/extensions.tsx index 451bc37869ee..e697ef5bd4d9 100644 --- a/packages/app/src/settings/providers/extensions.tsx +++ b/packages/app/src/settings/providers/extensions.tsx @@ -164,11 +164,7 @@ export const SettingsExtensions: Component<{ () => plugins.view(), (current) => { if (current.status !== "ready") return - dispatchUpdate({ - type: "list.loaded", - ready: current.value.ready !== false, - outdated: packageFlags(current.value.data), - }) + dispatchUpdate({ type: "list.loaded", outdated: packageFlags(current.value.data) }) }, { defer: true }, ), diff --git a/packages/app/src/settings/providers/plugin-update-machine.test.ts b/packages/app/src/settings/providers/plugin-update-machine.test.ts index 92729b1dee02..a07f2eb1e61e 100644 --- a/packages/app/src/settings/providers/plugin-update-machine.test.ts +++ b/packages/app/src/settings/providers/plugin-update-machine.test.ts @@ -81,20 +81,19 @@ test("an update runs once per package, then refreshes the list and hides the but // The server reloads its plugins after the update returns, so the refresh can read the old flag. Before, any list load // cleared what the update learned and the Update button came back until the next reload. -test("a list read before the server reloaded keeps an update's finding until a settled list agrees", () => { +test("a list read before the server reloaded keeps an update's finding until a list agrees", () => { const run = harness() run.dispatch({ type: "update.requested", target: a }) run.dispatch({ type: "update.succeeded", id: 0 }) const updated = run.machine.state - run.dispatch({ type: "list.loaded", ready: false, outdated: { [a]: true } }) - run.dispatch({ type: "list.loaded", ready: true, outdated: { [a]: true } }) + run.dispatch({ type: "list.loaded", outdated: { [a]: true } }) expect(run.machine.state).toBe(updated) expect(pluginUpdateView(run.machine.state, listed(a, true)).outdated).toBe(false) - run.dispatch({ type: "list.loaded", ready: true, outdated: { [a]: false } }) + run.dispatch({ type: "list.loaded", outdated: { [a]: false } }) expect(run.machine.state).not.toBe(updated) expect(pluginUpdateView(run.machine.state, listed(a, true)).outdated).toBe(true) diff --git a/packages/app/src/settings/providers/plugin-update-machine.ts b/packages/app/src/settings/providers/plugin-update-machine.ts index de9d892ac43a..d88c9286e58e 100644 --- a/packages/app/src/settings/providers/plugin-update-machine.ts +++ b/packages/app/src/settings/providers/plugin-update-machine.ts @@ -34,10 +34,10 @@ export type PluginUpdateEvent = | { readonly type: "update.succeeded"; readonly id: number } | { readonly type: "update.failed"; readonly id: number; readonly message: string } /** - * The plugin list loaded again. `ready` is false while the server is still reloading its plugins, when the list's - * flags may predate the latest check or update; `outdated` maps each listed package to its flag. + * The plugin list loaded again; `outdated` maps each listed package to its flag. A list read while the server still + * reloads its plugins can predate the latest check or update, so a finding is only dropped once a list agrees with it. */ - | { readonly type: "list.loaded"; readonly ready: boolean; readonly outdated: Readonly> } + | { readonly type: "list.loaded"; readonly outdated: Readonly> } /** Another server: forget what this one's checks and updates learned. */ | { readonly type: "server.changed" } | { readonly type: "disposed" } @@ -69,8 +69,6 @@ export function transitionPluginUpdate(state: PluginUpdateState, event: PluginUp if (event.type === "server.changed") return step({ status: "idle", nextId: state.nextId, findings: {}, updating: [] }) if (event.type === "list.loaded") { - if (!event.ready) return step(state) - const settled = Object.keys(state.findings).filter( (target) => !(target in event.outdated) || event.outdated[target] === state.findings[target]?.outdated, )