Skip to content

Commit

Permalink
fix(client-db): ensure ignoreSources is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Mar 8, 2023
1 parent 2bce04c commit 45b44a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/composables/client-db.ts
Expand Up @@ -26,8 +26,8 @@ export function createDB (storage: Storage) {
if (previewToken) {
// Ignore cache content if preview requires it
const previewMeta: any = await storage.getItem(`${previewToken}$`).then(data => data || {})
if (previewMeta.ignoreSources) {
const sources = previewMeta.ignoreSources.split(',').map(s => `cache:${s.trim()}:`)
if (Array.isArray(previewMeta.ignoreSources)) {
const sources = (previewMeta.ignoreSources as Array<string>).map(s => `cache:${s.trim()}:`)
// Remove all keys that starts with ignored sources
for (const key of keys) {
if (sources.some(s => key.startsWith(s))) {
Expand Down

0 comments on commit 45b44a6

Please sign in to comment.