Skip to content

Commit d69c50b

Browse files
waleedlatif1claude
andcommitted
fix: restore non-Linear files accidentally modified
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9afb0bc commit d69c50b

File tree

2 files changed

+5
-33
lines changed

2 files changed

+5
-33
lines changed

apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react'
3+
import { useCallback, useLayoutEffect, useRef } from 'react'
44
import { cn } from '@/lib/core/utils/cn'
55
import { MessageActions } from '@/app/workspace/[workspaceId]/components'
66
import { ChatMessageAttachments } from '@/app/workspace/[workspaceId]/home/components/chat-message-attachments'
@@ -99,41 +99,16 @@ export function MothershipChat({
9999
const hasMessages = messages.length > 0
100100
const initialScrollDoneRef = useRef(false)
101101

102-
const primedQueueIdRef = useRef<string | null>(null)
103-
const primeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
104102
const messageQueueRef = useRef(messageQueue)
105103
messageQueueRef.current = messageQueue
106104
const onSendQueuedMessageRef = useRef(onSendQueuedMessage)
107105
onSendQueuedMessageRef.current = onSendQueuedMessage
108106

109-
const clearPrimed = useCallback(() => {
110-
primedQueueIdRef.current = null
111-
if (primeTimerRef.current) {
112-
clearTimeout(primeTimerRef.current)
113-
primeTimerRef.current = null
114-
}
115-
}, [])
116-
117107
const handleEnterWhileEmpty = useCallback(() => {
118108
const topMessage = messageQueueRef.current[0]
119109
if (!topMessage) return false
120-
121-
if (primedQueueIdRef.current === topMessage.id) {
122-
clearPrimed()
123-
void onSendQueuedMessageRef.current(topMessage.id)
124-
return true
125-
}
126-
127-
primedQueueIdRef.current = topMessage.id
128-
if (primeTimerRef.current) clearTimeout(primeTimerRef.current)
129-
primeTimerRef.current = setTimeout(clearPrimed, 3000)
110+
void onSendQueuedMessageRef.current(topMessage.id)
130111
return true
131-
}, [clearPrimed])
132-
133-
useEffect(() => {
134-
return () => {
135-
if (primeTimerRef.current) clearTimeout(primeTimerRef.current)
136-
}
137112
}, [])
138113

139114
useLayoutEffect(() => {
@@ -235,7 +210,6 @@ export function MothershipChat({
235210
editValue={editValue}
236211
onEditValueConsumed={onEditValueConsumed}
237212
onEnterWhileEmpty={handleEnterWhileEmpty}
238-
onPrimedDismiss={clearPrimed}
239213
/>
240214
</div>
241215
</div>

apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ interface UserInputProps {
109109
userId?: string
110110
onContextAdd?: (context: ChatContext) => void
111111
onEnterWhileEmpty?: () => boolean
112-
onPrimedDismiss?: () => void
113112
}
114113

115114
export function UserInput({
@@ -123,7 +122,6 @@ export function UserInput({
123122
userId,
124123
onContextAdd,
125124
onEnterWhileEmpty,
126-
onPrimedDismiss,
127125
}: UserInputProps) {
128126
const { workspaceId } = useParams<{ workspaceId: string }>()
129127
const { data: workflowsById = {} } = useWorkflowMap(workspaceId)
@@ -456,7 +454,8 @@ export function UserInput({
456454
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
457455
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
458456
e.preventDefault()
459-
if (isSendingRef.current && !valueRef.current.trim() && onEnterWhileEmptyRef.current?.()) {
457+
if (isSendingRef.current && !valueRef.current.trim()) {
458+
onEnterWhileEmptyRef.current?.()
460459
return
461460
}
462461
handleSubmit()
@@ -551,9 +550,8 @@ export function UserInput({
551550

552551
setValue(newValue)
553552
restartRecognition(newValue)
554-
if (newValue.trim()) onPrimedDismiss?.()
555553
},
556-
[restartRecognition, onPrimedDismiss]
554+
[restartRecognition]
557555
)
558556

559557
const handleSelectAdjust = useCallback(() => {

0 commit comments

Comments
 (0)