diff --git a/web/src/components/ChannelList.tsx b/web/src/components/ChannelList.tsx
index f07a208..fe07e0e 100644
--- a/web/src/components/ChannelList.tsx
+++ b/web/src/components/ChannelList.tsx
@@ -190,15 +190,19 @@ export function ChannelList() {
};
const commitEditChannel = async () => {
- if (!editingChannelId || !editingChannelName.trim()) { setEditingChannelId(null); return; }
+ const id = editingChannelId;
+ const name = editingChannelName.trim();
+ setEditingChannelId(null);
+ if (!id || !name) return;
try {
const updated = await api.patch<{ id: string; server_id: string; name: string; type: string; category: string | null; position: number; group_id?: string | null }>(
- `/servers/${activeServerId}/channels/${editingChannelId}`,
- { name: editingChannelName.trim() }
+ `/servers/${activeServerId}/channels/${id}`,
+ { name }
);
updateChannel(updated as any);
- } catch { /* ignore */ }
- setEditingChannelId(null);
+ } catch (err) {
+ console.error('Rename channel failed:', err);
+ }
};
const deleteChannel = async (channelId: string, channelName: string) => {
@@ -224,12 +228,16 @@ export function ChannelList() {
};
const commitEditGroup = async () => {
- if (!editingGroupId || !editingGroupName.trim()) { setEditingGroupId(null); return; }
- try {
- await api.patch(`/servers/${activeServerId}/groups/${editingGroupId}`, { name: editingGroupName.trim() });
- refreshGroups();
- } catch { /* ignore */ }
+ const id = editingGroupId;
+ const name = editingGroupName.trim();
setEditingGroupId(null);
+ if (!id || !name) return;
+ try {
+ await api.patch(`/servers/${activeServerId}/groups/${id}`, { name });
+ refreshGroups();
+ } catch (err) {
+ console.error('Rename group failed:', err);
+ }
};
const deleteGroup = async (groupId: string, groupName: string) => {
@@ -253,16 +261,9 @@ export function ChannelList() {
return (
handleChannelContextMenu(e, channel)}>
-
+ )}
);
};
@@ -335,13 +345,9 @@ export function ChannelList() {
const isEditingGroup = editingGroupId === grp.id;
return (
-
{ toggleCollapsed(activeServerId || '', grp.id); setToggleTick(t => t + 1); }}
- onContextMenu={(e) => handleGroupContextMenu(e, grp)}
- >
-
{collapsed ? '[+]' : '[-]'}
- {isEditingGroup ? (
+ {isEditingGroup ? (
+
+ {collapsed ? '[+]' : '[-]'}
{ if (e.key === 'Enter') commitEditGroup(); if (e.key === 'Escape') setEditingGroupId(null); }}
className="flex-1 bg-gb-bg-t text-gb-fg px-1 py-0.5 text-xs outline-none border border-gb-orange"
- onClick={(e) => e.stopPropagation()}
/>
- ) : (
+
+ ) : (
+
{ toggleCollapsed(activeServerId || '', grp.id); setToggleTick(t => t + 1); }}
+ onContextMenu={(e) => handleGroupContextMenu(e, grp)}
+ >
+ {collapsed ? '[+]' : '[-]'}
{grp.name}
- )}
-
+
+ )}
{!collapsed && (
<>
---