Skip to content

Commit

Permalink
fix(core): Fix error with new session cache when seeding data
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 31, 2024
1 parent 1da470c commit 508f797
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ export class DefaultSessionCacheStrategy implements SessionCacheStrategy {
}

clear(): Promise<void> {
return this.cacheService.invalidateTags(this.tags);
// We use the `?` here because there is a case where in the SessionService,
// the clearSessionCacheOnDataChange() method may be invoked during bootstrap prior to
// the cacheService being initialized in the `init()` method above.
// This is an edge-case limited to seeding initial data as in e2e tests or a
// @vendure/create installation, so it is safe to not invalidate the cache in this case.
return this.cacheService?.invalidateTags(this.tags);
}

/**
Expand Down

0 comments on commit 508f797

Please sign in to comment.