Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(discord): rollback allowlist UI on save failure

cyhf3f9dbd3ae89
diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsx
index fa28b765f..663f42d43 100644
--- a/ui/src/components/steps/ChannelList.tsx
+++ b/ui/src/components/steps/ChannelList.tsx
@@ -227,16 +227,20 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
setSelectedGuild(guildId);
};
- const toggleAllowedGuild = (guildId: string, checked: boolean) => {
+ const toggleAllowedGuild = async (guildId: string, checked: boolean) => {
+ const previous = selectedGuildIds;
const next = checked
? addDiscordGuildToAllowlist(selectedGuildIds, guildId)
: selectedGuildIds.filter(id => id !== guildId);
setSelectedGuildIds(next);
- void persistDiscordGuildAllowlist(next);
+ const saved = await persistDiscordGuildAllowlist(next);
+ if (!saved) {
+ setSelectedGuildIds(previous);
+ }
};
- const persistDiscordGuildAllowlist = async (allowlist: string[]) => {
- if (!isPage) return;
+ const persistDiscordGuildAllowlist = async (allowlist: string[]): Promise<boolean> => {
+ if (!isPage) return true;
const updated = {
...config,
discord: {
@@ -244,12 +248,14 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
guild_allowlist: allowlist,
},
};
- setConfig(updated);
try {
await api.saveConfig(updated);
+ setConfig(updated);
showToast(t('common.saved'), 'success');
+ return true;
} catch {
showToast(t('channelList.settingsSaveFailed'), 'error');
+ return false;
}
};