fix: trigger backlog sync when text channel is selected
- Call POST /api/backlog-sync when user selects a text channel - Backlog sync now runs automatically on channel selection - Fetches messages from last 24 hours for selected channel only - Prevents empty message list on first channel selection This resolves: - Empty message list when selecting channel - Backlog sync not being triggered - Messages not loading until manual refresh Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -110,7 +110,15 @@
|
|||||||
el.channelSelect.value = state.selectedVoiceChannel;
|
el.channelSelect.value = state.selectedVoiceChannel;
|
||||||
el.channelFilter.value = state.selectedTextChannel;
|
el.channelFilter.value = state.selectedTextChannel;
|
||||||
applyActiveTab(state.activeTab);
|
applyActiveTab(state.activeTab);
|
||||||
if (textChanged || state.activeTab === 'text') await fetchText().catch((error) => showError(error.message));
|
if (textChanged || state.activeTab === 'text') {
|
||||||
|
if (state.selectedTextChannel && state.selectedGuild) {
|
||||||
|
await apiRequest('/api/backlog-sync', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ guildId: state.selectedGuild, channelId: state.selectedTextChannel }),
|
||||||
|
}).catch((error) => logger.warn('Backlog sync failed:', error.message));
|
||||||
|
}
|
||||||
|
await fetchText().catch((error) => showError(error.message));
|
||||||
|
}
|
||||||
await reconcileListenState();
|
await reconcileListenState();
|
||||||
await reconcileStreamingState();
|
await reconcileStreamingState();
|
||||||
state.applyingServerState = false;
|
state.applyingServerState = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user