fix: default single user state saving undefined value to state

This commit is contained in:
Andreas Coroiu 2024-07-02 15:49:30 +02:00
parent 1caa520328
commit 6c36da6ba5
No known key found for this signature in database
GPG Key ID: E70B5FFC81DFEC1A
1 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,9 @@ export class DefaultSingleUserState<T>
} }
protected override async doStorageSave(newState: T, oldState: T): Promise<void> { protected override async doStorageSave(newState: T, oldState: T): Promise<void> {
await super.doStorageSave(newState, oldState); if (newState != null) {
await super.doStorageSave(newState, oldState);
}
if (newState != null && oldState == null) { if (newState != null && oldState == null) {
await this.stateEventRegistrarService.registerEvents(this.keyDefinition); await this.stateEventRegistrarService.registerEvents(this.keyDefinition);
} }