mirror of https://github.com/langgenius/dify.git
improve cursors logic
This commit is contained in:
parent
d1a5db3310
commit
72037a1865
|
|
@ -41,7 +41,17 @@ const WorkflowMain = ({
|
|||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const store = useStoreApi()
|
||||
const { startCursorTracking, stopCursorTracking, onlineUsers } = useCollaboration(appId, store)
|
||||
const { startCursorTracking, stopCursorTracking, onlineUsers, cursors, isConnected } = useCollaboration(appId, store)
|
||||
const [myUserId, setMyUserId] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected)
|
||||
setMyUserId('current-user')
|
||||
}, [isConnected])
|
||||
|
||||
const filteredCursors = Object.fromEntries(
|
||||
Object.entries(cursors).filter(([userId]) => userId !== myUserId),
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (containerRef.current)
|
||||
|
|
@ -133,18 +143,6 @@ const WorkflowMain = ({
|
|||
handleWorkflowStartRunInWorkflow,
|
||||
} = useWorkflowStartRun()
|
||||
|
||||
const { cursors, isConnected } = useCollaboration(appId)
|
||||
const [myUserId, setMyUserId] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected)
|
||||
setMyUserId('current-user')
|
||||
}, [isConnected])
|
||||
|
||||
const filteredCursors = Object.fromEntries(
|
||||
Object.entries(cursors).filter(([userId]) => userId !== myUserId),
|
||||
)
|
||||
|
||||
const { fetchInspectVars } = useSetWorkflowVarsWithValue({
|
||||
flowId: appId,
|
||||
...useConfigsMap(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue