diff --git a/libs/services/src/lib/server-storage-status.service.spec.ts b/libs/services/src/lib/server-storage-status.service.spec.ts index 319ec7823..4707e0029 100644 --- a/libs/services/src/lib/server-storage-status.service.spec.ts +++ b/libs/services/src/lib/server-storage-status.service.spec.ts @@ -93,4 +93,14 @@ describe('ServerStorageStatusService', () => { expect(status.state()).toBe('online'); expect(readServerAccessToken('i-1')).toBe('kept'); }); + + it('checks the instance again after an outage on the sign-in page', () => { + status.activate(instance, jest.fn()); + status.reportUnauthorized(); + + status.reportOffline(); + + expect(status.state()).toBe('unauthorized'); + expect(status.isVerified()).toBe(false); + }); }); diff --git a/libs/services/src/lib/server-storage-status.service.ts b/libs/services/src/lib/server-storage-status.service.ts index b5893b08b..830399abc 100644 --- a/libs/services/src/lib/server-storage-status.service.ts +++ b/libs/services/src/lib/server-storage-status.service.ts @@ -77,11 +77,15 @@ export class ServerStorageStatusService { } reportOffline(): void { + if (!this.isActive()) { + return; + } + // It may come back as another database (a replaced volume at the + // same address): no token, no writes until it is checked, also + // from the sign-in page. + this.verified = false; // A late failure after sign-out must not unlock the workspace. - if (this.isActive() && this.stateSignal() !== 'unauthorized') { - // It may come back as another database (a replaced volume at - // the same address): no token, no writes until it is checked. - this.verified = false; + if (this.stateSignal() !== 'unauthorized') { this.stateSignal.set('offline'); } }