diff --git a/src/index.ts b/src/index.ts index 496edac2..4422a313 100755 --- a/src/index.ts +++ b/src/index.ts @@ -627,14 +627,13 @@ 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() - } - cacheVersions[params.token] = params.cv ? params.cv : response.data.cv + if ( + response.data.cv + && params.token + && cacheVersions[params.token] != response.data.cv + ) { + await this.flushCache() + cacheVersions[params.token] = response.data.cv } return resolve(response)