mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 19:02:31 +00:00
fix(monitor): keep active discovery independent of cache refresh
This commit is contained in:
@@ -529,13 +529,14 @@ export function LxcAppPanel({ vmid, ctIp, onChange, managed, initialData, oci, c
|
|||||||
}, [vmid, managed])
|
}, [vmid, managed])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const generation = targetGeneration.current
|
const generation = targetGeneration.current
|
||||||
const request = ++nativeRequest.current
|
const request = nativeRequest.current
|
||||||
|
let cancelled = false
|
||||||
if (managed) return
|
if (managed) return
|
||||||
fetchApi<NativeDiscovery>(`/api/vms/${vmid}/apps/native-discovery`).then(result => {
|
fetchApi<NativeDiscovery>(`/api/vms/${vmid}/apps/native-discovery`).then(result => {
|
||||||
if (targetRef.current === vmid && targetGeneration.current === generation
|
if (!cancelled && targetRef.current === vmid && targetGeneration.current === generation
|
||||||
&& nativeRequest.current === request) setNativeDiscovery(result)
|
&& nativeRequest.current === request) setNativeDiscovery(result)
|
||||||
}).catch(() => { /* cached metadata is optional; never initiate a scan */ })
|
}).catch(() => { /* cached metadata is optional; never initiate a scan */ })
|
||||||
return () => { nativeRequest.current += 1 }
|
return () => { cancelled = true }
|
||||||
}, [vmid, managed, cacheRevision])
|
}, [vmid, managed, cacheRevision])
|
||||||
const [adguardSetupAvailable, setAdguardSetupAvailable] = useState(false)
|
const [adguardSetupAvailable, setAdguardSetupAvailable] = useState(false)
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ async function editor(ports = [8080]) {
|
|||||||
}
|
}
|
||||||
async function main() {
|
async function main() {
|
||||||
await cachedImageContract()
|
await cachedImageContract()
|
||||||
|
const scanning = fixture()
|
||||||
|
scanning.renderParent(); await scanning.settle(); scanning.holdScan()
|
||||||
|
const pendingScan = scanning.button('searchApplications').props.onClick(); scanning.render()
|
||||||
|
scanning.renderParent(101, 1); await scanning.settle()
|
||||||
|
scanning.resolveScan(); await pendingScan; scanning.render()
|
||||||
|
assert.equal(scanning.button('searchApplications').props.disabled, false, 'revision must not leave an active Native Find stuck busy')
|
||||||
const existing = fixture({apps: [{id: 'existing', name: 'Saved app', ports: [{port: 8080, scheme: 'http'}], state: {}}]})
|
const existing = fixture({apps: [{id: 'existing', name: 'Saved app', ports: [{port: 8080, scheme: 'http'}], state: {}}]})
|
||||||
existing.renderParent(); await existing.settle()
|
existing.renderParent(); await existing.settle()
|
||||||
const click = async key => {
|
const click = async key => {
|
||||||
|
|||||||
Reference in New Issue
Block a user