ui : drop unused currentResponse reactive writes

Nothing reads chatStore.currentResponse, but setChatStreaming reassigned
it on every streamed chunk, so each token paid a reactive write and string
assignment for nothing. Remove the field and the clearUIState wrapper
that only reset it.

Assisted-by: pi:zai-org/GLM-5.3
This commit is contained in:
Aleksander Grygier
2026-09-06 01:47:54 +02:00
parent c206e661f7
commit 03eb7b3d4c
2 changed files with 1 additions and 13 deletions
@@ -55,7 +55,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
string,
{ response: string; messageId: string; model?: string | null }
>();
currentResponse = $state('');
errorDialogState = $state<ErrorDialogState | null>(null);
// true while the active conversation has a local pipe (send, attach or resume-wait)
isLoading = $derived(this.activity.isLocal(conversationsStore.activeConversation?.id ?? ''));
@@ -256,8 +255,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
}
this.chatStreamingStates.delete(convId);
if (convId === conversationsStore.activeConversation?.id) this.currentResponse = '';
}
clearEditMode(): void {
this.isEditModeActive = false;
@@ -272,11 +269,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
this.pendingMessages.delete(convId);
}
/** Reset per-view state when (re)mounting the empty chat screen. */
clearUIState(): void {
this.currentResponse = '';
}
consumePendingDraft(): { message: string; files: ChatUploadedFile[] } | null {
if (!this.pendingDraftMessage && this.pendingDraftFiles.length === 0) return null;
@@ -766,8 +758,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
model: model ?? this.chatStreamingStates.get(convId)?.model,
response
});
if (convId === conversationsStore.activeConversation?.id) this.currentResponse = response;
}
setEditModeActive(handler: (files: File[]) => void): void {
@@ -1244,7 +1234,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
syncLoadingStateForChat(convId: string): void {
const s = this.chatStreamingStates.get(convId);
this.currentResponse = s?.response || '';
this.processing.setActiveConversation(convId);
// Sync streaming content to activeMessages so UI displays current content
+1 -2
View File
@@ -3,7 +3,7 @@
import { page } from '$app/state';
import { DialogModelNotAvailable } from '$lib/components/app';
import { APP_NAME, URL_PARAMS } from '$lib/constants';
import { chatStore, conversationsStore, modelsStore, serverStore } from '$lib/stores';
import { conversationsStore, modelsStore, serverStore } from '$lib/stores';
import { onMount } from 'svelte';
let qParam = $derived(page.url.searchParams.get(URL_PARAMS.QUERY));
@@ -77,7 +77,6 @@
}
conversationsStore.clearActiveConversation();
chatStore.clearUIState();
await modelsStore.fetch();