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): avoid stale config saves

cyhd10c703c469d
diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsx
index 57de6d871..198b98bf6 100644
--- a/ui/src/components/steps/ChannelList.tsx
+++ b/ui/src/components/steps/ChannelList.tsx
@@ -128,9 +128,9 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
return configVersionRef.current;
};
- const saveConfigSnapshot = async (snapshot: any): Promise<boolean> => {
+ const saveLatestConfig = async (): Promise<boolean> => {
const saveTask = configSaveQueueRef.current.then(async () => {
- await api.saveConfig(snapshot);
+ await api.saveConfig(configRef.current);
});
configSaveQueueRef.current = saveTask.catch(() => {});
try {
@@ -298,7 +298,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
},
};
applyConfig(updated);
- const saved = await saveConfigSnapshot(updated);
+ const saved = await saveLatestConfig();
if (saved) {
showToast(t('common.saved'), 'success');
return true;
@@ -754,7 +754,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB
[key]: { ...(currentConfig as any)[key], require_mention: !current },
};
const version = applyConfig(updated);
- const saved = await saveConfigSnapshot(updated);
+ const saved = await saveLatestConfig();
if (saved) {
showToast(t('common.saved'), 'success');
} else if (configVersionRef.current === version) {
diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsx
index 7c0530116..0878f55fa 100644
--- a/ui/src/components/steps/Summary.tsx
+++ b/ui/src/components/steps/Summary.tsx
@@ -27,6 +27,7 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
const [codeCopied, setCodeCopied] = useState(false);
const enabledPlatforms = getEnabledPlatforms(data);
const primaryPlatform = getPrimaryPlatform(data);
+ const discordGuildAllowlist = Array.isArray(data.discord?.guild_allowlist) ? data.discord.guild_allowlist : [];
const [requireMentionByPlatform, setRequireMentionByPlatform] = useState<Record<string, boolean>>(
Object.fromEntries(
enabledPlatforms.map((platform) => [
@@ -210,7 +211,7 @@ export const Summary: React.FC<SummaryProps> = ({ data, onBack }) => {
<Section title={t('summary.discordBotToken')} value={mask(data.discord?.bot_token || '')} />
<Section
title={t('summary.discordGuild')}
- value={(data.discord?.guild_allowlist || []).join(', ') || t('summary.notSet')}
+ value={discordGuildAllowlist.join(', ') || t('summary.notSet')}
/>
</>
)}