Add stop/cancel action for message sending loading indicator #130
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#130
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The loading indicator currently shows while a message is being sent, but users cannot cancel the operation. This change adds a stop/cancel action to the loading indicator which cancels the coroutine job that runs the
SendMessageUseCase, resetting the UI to a non-sending state.Motivation
Implementation plan (high level)
ChatViewModel(file:app/src/commonMain/kotlin/eu/torvian/chatbot/app/viewmodel/chat/ChatViewModel.kt): store the active message sendingJob?and addcancelSendMessage()which cancels the job and ensures the sending state is reset.sendMessage()inChatViewModel: capture the launched coroutineJoband store it in the tracking field; clear it on completion (e.g., infinally).onCancelSendMessagecallback toChatAreaActions(file:app/src/commonMain/kotlin/eu/torvian/chatbot/app/compose/chatarea/ChatAreaActions.kt).ChatScreen: implementonCancelSendMessagein thechatAreaActionsobject to callchatViewModel.cancelSendMessage().InputArea(file:app/src/commonMain/kotlin/eu/torvian/chatbot/app/compose/chatarea/InputArea.kt): add parameteronCancelSendMessage: () -> Unitand change the loading indicator button onClick to call it.ChatArea(file:app/src/commonMain/kotlin/eu/torvian/chatbot/app/compose/chatarea/ChatArea.kt): addonCancelSendMessageparameter and pass it toInputArea.Further considerations
SendMessageUseCasealready callsstate.setIsSending(false)in afinallyblock; test that cancellation leads to the expected state transitions.Acceptance criteria
isSendingMessageto false.Files likely touched
Notes
enhancementanduxand assigneerwachters.