ненавижу вайбкодеров
This commit is contained in:
parent
b3ea9d84cb
commit
7200b4cd62
1 changed files with 3 additions and 4 deletions
|
|
@ -175,21 +175,20 @@ export function ObjectDetailPage({ defaultMode = 'inventory' }: { defaultMode?:
|
||||||
const [editRackForm] = Form.useForm()
|
const [editRackForm] = Form.useForm()
|
||||||
|
|
||||||
const currentAction = actions?.find((a) => a.name === selectedAction)
|
const currentAction = actions?.find((a) => a.name === selectedAction)
|
||||||
const discoveryRunning = discoverMutation.isPending || !!discoveryTaskId || !!discoveryStatus.data?.running
|
const discoveryRunning = discoverMutation.isPending || !!discoveryStatus.data?.running
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const statusTaskId = discoveryStatus.data?.task_id
|
const statusTaskId = discoveryStatus.data?.task_id
|
||||||
const statusRunning = !!discoveryStatus.data?.running
|
const statusRunning = !!discoveryStatus.data?.running
|
||||||
|
|
||||||
if (statusRunning) {
|
if (statusRunning) {
|
||||||
// Re-attach only when drawer is closed and we don't already track the running task.
|
if (statusTaskId && discoveryTaskId !== statusTaskId) {
|
||||||
if (!discoveryOpen && !discoveryTaskId && statusTaskId) {
|
|
||||||
setDiscoveryTaskId(statusTaskId)
|
setDiscoveryTaskId(statusTaskId)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusTaskId && discoveryTaskId === statusTaskId) {
|
if (!discoveryOpen && statusTaskId && discoveryTaskId === statusTaskId) {
|
||||||
setDiscoveryTaskId(null)
|
setDiscoveryTaskId(null)
|
||||||
}
|
}
|
||||||
}, [discoveryStatus.data, discoveryTaskId, discoveryOpen])
|
}, [discoveryStatus.data, discoveryTaskId, discoveryOpen])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue