MCPcopy Index your code
hub / github.com/TanStack/ai / updateLoadingState

Function updateLoadingState

examples/vanilla-chat/src/main.js:120–144  ·  view source on GitHub ↗
(isLoading)

Source from the content-addressed store, hash-verified

118
119// Update loading state
120function updateLoadingState(isLoading) {
121 if (sendButton) {
122 sendButton.disabled = isLoading
123 sendButton.textContent = isLoading ? 'Sending...' : 'Send'
124 }
125
126 if (messageInput) {
127 messageInput.disabled = isLoading
128 }
129
130 // Show typing indicator
131 if (isLoading && messagesContainer) {
132 const typingIndicator = document.createElement('div')
133 typingIndicator.className = 'message assistant typing'
134 typingIndicator.id = 'typing-indicator'
135 typingIndicator.innerHTML = '<div class="message-content">...</div>'
136 messagesContainer.appendChild(typingIndicator)
137 messagesContainer.scrollTop = messagesContainer.scrollHeight
138 } else {
139 const indicator = document.getElementById('typing-indicator')
140 if (indicator) {
141 indicator.remove()
142 }
143 }
144}
145
146// Show error
147function showError(error) {

Callers 1

main.jsFile · 0.85

Calls 1

removeMethod · 0.65

Tested by

no test coverage detected