Skip to content

Commit

Permalink
Merge pull request #1098 from forcedotcom/wr/noListenerEntries
Browse files Browse the repository at this point in the history
fix: allow for undefined uniqueListerners
  • Loading branch information
WillieRuemmele authored Jul 3, 2024
2 parents f08cce8 + 5c6779c commit ab39315
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lifecycleEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,6 @@ export class Lifecycle {
}

const cloneListeners: (listeners: ListenerMap) => ListenerMap = (listeners) => new Map(Array.from(listeners.entries()));
export const cloneUniqueListeners = (uniqueListeners: UniqueListenerMap): UniqueListenerMap =>
new Map(Array.from(uniqueListeners.entries()).map(([key, value]) => [key, cloneListeners(value)]));
export const cloneUniqueListeners = (uniqueListeners: UniqueListenerMap | undefined): UniqueListenerMap =>
// in case we're crossing major sfdx-core versions where uniqueListeners might be undefined
new Map(Array.from(uniqueListeners?.entries() ?? []).map(([key, value]) => [key, cloneListeners(value)]));

0 comments on commit ab39315

Please sign in to comment.