Skip to content

Commit

Permalink
feat: improve cv cache flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
juusopiikkila committed Aug 2, 2024
1 parent 8a938c3 commit fbc43b7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,12 @@ class Storyblok {
await provider.set(cacheKey, response)
}

if (response.data.cv && params.token) {
if (
params.version === 'draft' &&
cacheVersions[params.token] != response.data.cv
) {
await this.flushCache()
}
if (
response.data.cv
&& params.token
&& cacheVersions[params.token] != response.data.cv
) {
await this.flushCache()
cacheVersions[params.token] = params.cv ? params.cv : response.data.cv
}

Expand Down

0 comments on commit fbc43b7

Please sign in to comment.