From 1008afd1fed6be21d5a2503bed322a58402a476e Mon Sep 17 00:00:00 2001 From: Oscar Zhou <100548325+oscarzhou-portainer@users.noreply.github.com> Date: Fri, 9 Dec 2022 11:11:24 +1300 Subject: [PATCH] fix(session): reset the environment session storage after deleting it (#8119) --- app/portainer/services/endpointProvider.ts | 7 +++++++ app/portainer/views/endpoints/endpointsController.js | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/portainer/services/endpointProvider.ts b/app/portainer/services/endpointProvider.ts index 45636ce01..a6ea611d7 100644 --- a/app/portainer/services/endpointProvider.ts +++ b/app/portainer/services/endpointProvider.ts @@ -33,6 +33,13 @@ export function EndpointProvider() { if (endpoint && endpoint.Type === EnvironmentType.EdgeAgentOnDocker) { state.pingInterval = setInterval(() => ping(endpoint.Id), 60 * 1000); } + + if (endpoint === null) { + sessionStorage.setItem( + 'portainer.environmentId', + JSON.stringify(undefined) + ); + } } function currentEndpoint() { diff --git a/app/portainer/views/endpoints/endpointsController.js b/app/portainer/views/endpoints/endpointsController.js index 07f09ed62..f18c44c22 100644 --- a/app/portainer/views/endpoints/endpointsController.js +++ b/app/portainer/views/endpoints/endpointsController.js @@ -46,8 +46,6 @@ export class EndpointsController { // If the current endpoint was deleted, then clean endpoint store if (endpoints.some((e) => e.Id === id)) { this.StateManager.cleanEndpoint(); - // trigger sidebar rerender - this.applicationState.endpoint = {}; } this.$state.reload();