Skip to content

Commit 62e1ebe

Browse files
committed
remove unused hook
1 parent ec64991 commit 62e1ebe

File tree

6 files changed

+0
-77
lines changed

6 files changed

+0
-77
lines changed

apps/sim/hooks/use-debounce.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ export function useDebounce<T>(value: T, delay: number): T {
1010
const [debouncedValue, setDebouncedValue] = useState<T>(value)
1111

1212
useEffect(() => {
13-
// Set a timeout to update the debounced value after the delay
1413
const timer = setTimeout(() => {
1514
setDebouncedValue(value)
1615
}, delay)
1716

18-
// Clean up the timeout if the value changes before the delay has passed
1917
return () => {
2018
clearTimeout(timer)
2119
}

apps/sim/hooks/use-execution-stream.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ export function useExecutionStream() {
8181
const execute = useCallback(async (options: ExecuteStreamOptions) => {
8282
const { workflowId, callbacks = {}, ...payload } = options
8383

84-
// Cancel any existing execution
8584
if (abortControllerRef.current) {
8685
abortControllerRef.current.abort()
8786
}
8887

89-
// Create new abort controller
9088
const abortController = new AbortController()
9189
abortControllerRef.current = abortController
9290
currentExecutionRef.current = null
@@ -115,7 +113,6 @@ export function useExecutionStream() {
115113
currentExecutionRef.current = { workflowId, executionId }
116114
}
117115

118-
// Read SSE stream
119116
const reader = response.body.getReader()
120117
const decoder = new TextDecoder()
121118
let buffer = ''
@@ -128,13 +125,10 @@ export function useExecutionStream() {
128125
break
129126
}
130127

131-
// Decode chunk and add to buffer
132128
buffer += decoder.decode(value, { stream: true })
133129

134-
// Process complete SSE messages
135130
const lines = buffer.split('\n\n')
136131

137-
// Keep the last incomplete message in the buffer
138132
buffer = lines.pop() || ''
139133

140134
for (const line of lines) {
@@ -144,7 +138,6 @@ export function useExecutionStream() {
144138

145139
const data = line.substring(6).trim()
146140

147-
// Check for [DONE] marker
148141
if (data === '[DONE]') {
149142
logger.info('Stream completed')
150143
continue
@@ -153,14 +146,12 @@ export function useExecutionStream() {
153146
try {
154147
const event = JSON.parse(data) as ExecutionEvent
155148

156-
// Log all SSE events for debugging
157149
logger.info('📡 SSE Event received:', {
158150
type: event.type,
159151
executionId: event.executionId,
160152
data: event.data,
161153
})
162154

163-
// Dispatch event to appropriate callback
164155
switch (event.type) {
165156
case 'execution:started':
166157
logger.info('🚀 Execution started')

apps/sim/hooks/use-focus-on-block.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

apps/sim/hooks/use-mcp-tools.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export interface UseMcpToolsResult {
3232
isLoading: boolean
3333
error: string | null
3434
refreshTools: (forceRefresh?: boolean) => Promise<void>
35-
getToolById: (toolId: string) => McpToolForUI | undefined
3635
getToolsByServer: (serverId: string) => McpToolForUI[]
3736
}
3837

@@ -72,13 +71,6 @@ export function useMcpTools(workspaceId: string): UseMcpToolsResult {
7271
[workspaceId, queryClient]
7372
)
7473

75-
const getToolById = useCallback(
76-
(toolId: string): McpToolForUI | undefined => {
77-
return mcpTools.find((tool) => tool.id === toolId)
78-
},
79-
[mcpTools]
80-
)
81-
8274
const getToolsByServer = useCallback(
8375
(serverId: string): McpToolForUI[] => {
8476
return mcpTools.filter((tool) => tool.serverId === serverId)
@@ -91,7 +83,6 @@ export function useMcpTools(workspaceId: string): UseMcpToolsResult {
9183
isLoading,
9284
error: queryError instanceof Error ? queryError.message : null,
9385
refreshTools,
94-
getToolById,
9586
getToolsByServer,
9687
}
9788
}

apps/sim/hooks/use-stream-cleanup.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,21 @@ import { useCallback, useEffect } from 'react'
1111
* - Tab is closed
1212
*/
1313
export function useStreamCleanup(cleanup: () => void) {
14-
// Wrap cleanup function to ensure it's stable
1514
const stableCleanup = useCallback(() => {
1615
try {
1716
cleanup()
1817
} catch (error) {
19-
// Ignore errors during cleanup to prevent issues during page unload
2018
console.warn('Error during stream cleanup:', error)
2119
}
2220
}, [cleanup])
2321

2422
useEffect(() => {
25-
// Handle page unload/navigation/refresh
2623
const handleBeforeUnload = () => {
2724
stableCleanup()
2825
}
2926

30-
// Add event listeners
3127
window.addEventListener('beforeunload', handleBeforeUnload)
3228

33-
// Cleanup on component unmount
3429
return () => {
3530
window.removeEventListener('beforeunload', handleBeforeUnload)
3631
stableCleanup()

apps/sim/hooks/use-tag-selection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export function useTagSelection(blockId: string, subblockId: string) {
1010

1111
const emitTagSelectionValue = useCallback(
1212
(value: any) => {
13-
// Use the collaborative system with immediate processing (no debouncing)
1413
collaborativeSetTagSelection(blockId, subblockId, value)
1514
},
1615
[blockId, subblockId, collaborativeSetTagSelection]

0 commit comments

Comments
 (0)