Skip to content

Commit 91906ae

Browse files
committed
fix tests
1 parent 0cbd4f3 commit 91906ae

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

static/app/appQueryClient.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ const localStoragePersister = createAsyncStoragePersister({
2121
key: cacheKey,
2222
});
2323

24-
const isProjectsCacheEnabled = (
25-
window.__initialData?.features as unknown as string[]
26-
)?.includes('organizations:cache-projects-ui');
24+
const isProjectsCacheEnabled =
25+
window.indexedDB &&
26+
(window.__initialData?.features as unknown as string[])?.includes(
27+
'organizations:cache-projects-ui'
28+
);
2729

2830
/**
2931
* Attach the persister to the query client
@@ -60,6 +62,8 @@ export function restoreQueryCache() {
6062
}
6163

6264
export async function clearQueryCache() {
63-
await localStoragePersister.removeClient();
64-
await removeItem(cacheKey);
65+
if (isProjectsCacheEnabled) {
66+
await localStoragePersister.removeClient();
67+
await removeItem(cacheKey);
68+
}
6569
}

0 commit comments

Comments
 (0)