Skip to content

Commit

Permalink
fix: turn state undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Gummersall committed Mar 27, 2021
1 parent 7c89476 commit 7413699
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/botbuilder-dialogs/src/memory/dialogStateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export class DialogStateManager {
});

// merge in turn state memory scopes
this.configuration.memoryScopes.push(...dc.context.turnState.get<MemoryScope[]>('memoryScopes'));
const memoryScopes = dc.context.turnState.get<MemoryScope[]>('memoryScopes') ?? [];
this.configuration.memoryScopes.push(...memoryScopes);

// get all of the component path resolvers.
ComponentRegistration.components
Expand All @@ -75,7 +76,8 @@ export class DialogStateManager {
});

// merge in turn state ones path resolvers
this.configuration.pathResolvers.push(...dc.context.turnState.get<PathResolver[]>('pathResolvers'));
const pathResolvers = dc.context.turnState.get<PathResolver[]>('pathResolvers') ?? [];
this.configuration.pathResolvers.push(...pathResolvers);

// cache for any other new dialogStateManager instances in this turn
dc.context.turnState.set(DIALOG_STATE_MANAGER_CONFIGURATION, this.configuration);
Expand Down

0 comments on commit 7413699

Please sign in to comment.