1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

fix(app): properly update the app state when losing connectivity to a remote environment while browsing it (#11943)
Some checks failed
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:s390x platform:linux version:]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_manifests (push) Has been cancelled

This commit is contained in:
LP B 2024-06-19 13:45:02 +02:00 committed by GitHub
parent e7af3296fc
commit 9339d10233
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 25 deletions

View file

@ -1,6 +1,8 @@
import { useStore } from 'zustand';
import { useCurrentStateAndParams, useRouter } from '@uirouter/react';
import { useEffect, useState } from 'react';
import { environmentStore } from '@/react/hooks/current-environment-store';
import { Environment } from '@/react/portainer/environments/types';
import { snapshotEndpoints } from '@/react/portainer/environments/environment.service';
import { isEdgeEnvironment } from '@/react/portainer/environments/utils';
@ -18,6 +20,8 @@ import { LicenseNodePanel } from './LicenseNodePanel';
import { BackupFailedPanel } from './BackupFailedPanel';
export function HomeView() {
const { clear: clearStore } = useStore(environmentStore);
const { params } = useCurrentStateAndParams();
const [connectingToEdgeEndpoint, setConnectingToEdgeEndpoint] = useState(
!!params.redirect
@ -40,14 +44,19 @@ export function HomeView() {
endpointId: params.environmentId,
});
} else {
router.stateService.go('portainer.home', {}, { inherit: false });
clearStore();
router.stateService.go(
'portainer.home',
{},
{ reload: true, inherit: false }
);
}
}
if (params.redirect) {
redirect();
}
}, [params, setConnectingToEdgeEndpoint, router]);
}, [params, setConnectingToEdgeEndpoint, router, clearStore]);
return (
<>