Skip to content

Commit d904604

Browse files
authored
Revert "fix(sockets-server-disconnection): on reconnect force sync store to d…" (#640)
This reverts commit 6dc8b17.
1 parent 2c9a4f4 commit d904604

File tree

5 files changed

+9
-365
lines changed

5 files changed

+9
-365
lines changed

apps/sim/app/api/workflows/[id]/force-sync/route.ts

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

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/user-avatar-stack/components/connection-status/connection-status.tsx

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,36 @@ import { useEffect, useState } from 'react'
44

55
interface ConnectionStatusProps {
66
isConnected: boolean
7-
isSyncing: boolean
87
}
98

10-
export function ConnectionStatus({ isConnected, isSyncing }: ConnectionStatusProps) {
9+
export function ConnectionStatus({ isConnected }: ConnectionStatusProps) {
1110
const [showOfflineNotice, setShowOfflineNotice] = useState(false)
12-
const [syncCompleted, setSyncCompleted] = useState(false)
1311

1412
useEffect(() => {
1513
let timeoutId: NodeJS.Timeout
1614

1715
if (!isConnected) {
16+
// Show offline notice after 6 seconds of being disconnected
1817
timeoutId = setTimeout(() => {
1918
setShowOfflineNotice(true)
2019
}, 6000) // 6 seconds
21-
} else if (isConnected && showOfflineNotice && !isSyncing && syncCompleted) {
20+
} else {
21+
// Hide notice immediately when reconnected
2222
setShowOfflineNotice(false)
23-
setSyncCompleted(false)
2423
}
2524

2625
return () => {
2726
if (timeoutId) {
2827
clearTimeout(timeoutId)
2928
}
3029
}
31-
}, [isConnected, isSyncing, showOfflineNotice, syncCompleted])
32-
33-
// Track when sync completes
34-
useEffect(() => {
35-
if (!isSyncing && showOfflineNotice && isConnected) {
36-
setSyncCompleted(true)
37-
}
38-
}, [isSyncing, showOfflineNotice, isConnected])
30+
}, [isConnected])
3931

4032
// Don't render anything if connected or if we haven't been disconnected long enough
4133
if (!showOfflineNotice) {
4234
return null
4335
}
4436

45-
// Show different states based on connection and sync status
46-
if (isConnected && isSyncing) {
47-
return (
48-
<div className='flex items-center gap-1.5'>
49-
<div className='flex items-center gap-1.5 text-yellow-600'>
50-
<div className='relative flex items-center justify-center'>
51-
<div className='absolute h-3 w-3 animate-ping rounded-full bg-yellow-500/20' />
52-
<div className='relative h-2 w-2 rounded-full bg-yellow-500' />
53-
</div>
54-
<div className='flex flex-col'>
55-
<span className='font-medium text-xs leading-tight'>Syncing changes</span>
56-
<span className='text-xs leading-tight opacity-90'>
57-
Saving local changes to database...
58-
</span>
59-
</div>
60-
</div>
61-
</div>
62-
)
63-
}
64-
6537
return (
6638
<div className='flex items-center gap-1.5'>
6739
<div className='flex items-center gap-1.5 text-red-600'>

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/user-avatar-stack/user-avatar-stack.tsx

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

33
import { useMemo } from 'react'
4-
import { useSocket } from '@/contexts/socket-context'
54
import { usePresence } from '../../../../hooks/use-presence'
65
import { ConnectionStatus } from './components/connection-status/connection-status'
76
import { UserAvatar } from './components/user-avatar/user-avatar'
@@ -28,7 +27,6 @@ export function UserAvatarStack({
2827
}: UserAvatarStackProps) {
2928
// Use presence data if no users are provided via props
3029
const { users: presenceUsers, isConnected } = usePresence()
31-
const { isSyncing } = useSocket()
3230
const users = propUsers || presenceUsers
3331

3432
// Memoize the processed users to avoid unnecessary re-renders
@@ -47,10 +45,8 @@ export function UserAvatarStack({
4745
}, [users, maxVisible])
4846

4947
// Show connection status component regardless of user count
50-
// This will handle the offline notice when disconnected for 6 seconds
51-
const connectionStatusElement = (
52-
<ConnectionStatus isConnected={isConnected} isSyncing={isSyncing} />
53-
)
48+
// This will handle the offline notice when disconnected for 15 seconds
49+
const connectionStatusElement = <ConnectionStatus isConnected={isConnected} />
5450

5551
// Only show presence when there are multiple users (>1)
5652
// But always show connection status

0 commit comments

Comments
 (0)