Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Packages: once the server has added or removed an item, only that is reported; refreshing the lists afterwards cannot turn it into an error

Simon Flack610f3c72eae1
diff --git a/console/apps/switch-console-desktop/src/renderer/features/library/package-members.tsx b/console/apps/switch-console-desktop/src/renderer/features/library/package-members.tsx
index d7558bddd..7c514007e 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/library/package-members.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/library/package-members.tsx
@@ -103,21 +103,26 @@ function MemberSection({
async function remove(member: LibraryItem) {
setBusy(member.id);
setError(null);
+ let removal;
try {
- const removal = await rpc.workspaces.removePackageMember({
+ removal = await rpc.workspaces.removePackageMember({
workspaceId,
packageId: pkg.id,
kind,
memberId: member.id,
});
- onRemoved(removalText(member.name, removal));
- await refreshAfterChange(queryClient, workspaceId, pkg.id, kind);
} catch (cause) {
setError(failureText(cause, `Could not remove ${member.name} from the package.`));
- } finally {
setBusy(null);
setArmed(null);
+ return;
}
+ // Removed: only the removal speaks for itself. Refreshing what shows it
+ // comes after, so a refresh that fails cannot report the removal as failed.
+ onRemoved(removalText(member.name, removal));
+ setBusy(null);
+ setArmed(null);
+ await refreshAfterChange(queryClient, workspaceId, pkg.id, kind).catch(() => {});
}
return (
@@ -263,12 +268,14 @@ function AddMemberDialog({
memberId: item.id,
});
setDone((current) => new Set(current).add(item.id));
- await refreshAfterChange(queryClient, workspaceId, pkg.id, kind);
} catch (cause) {
setError(failureText(cause, `Could not add ${item.name} to the package.`));
+ return;
} finally {
setBusy(null);
}
+ // As for removing: a refresh that fails does not make the add a failure.
+ await refreshAfterChange(queryClient, workspaceId, pkg.id, kind).catch(() => {});
}
return (