Skip to content

Commit

Permalink
Merge pull request #807 from storyblok/fix/flushcache-clear-cv
Browse files Browse the repository at this point in the history
fix: clear cacheVersions on flushCache
  • Loading branch information
christianzoppi authored Apr 15, 2024
2 parents 644fd93 + 8bce878 commit b6abea2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ class Storyblok {
}
}

public clearCacheVersion(): void {
if (this.accessToken) {
cacheVersions[this.accessToken] = 0
}
}

private cacheProvider(): ICacheProvider {
switch (this.cache.type) {
case 'memory':
Expand Down Expand Up @@ -722,6 +728,7 @@ class Storyblok {

public async flushCache(): Promise<this> {
await this.cacheProvider().flush()
this.clearCacheVersion()
return this
}
}
Expand Down

0 comments on commit b6abea2

Please sign in to comment.