Bust cache with version

old-stable24
Varun Patil 2022-10-16 13:18:47 -07:00
parent c679a5f2d1
commit 16f1562ade
2 changed files with 4 additions and 1 deletions

View File

@ -69,6 +69,7 @@ class PageController extends Controller {
// Apps enabled
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true);
$this->initialState->provideInitialState('version', $this->appManager->getAppInfo('memories')["version"]);
$response = new TemplateResponse($this->appName, 'main');
return $response;

View File

@ -1,5 +1,6 @@
import { getCanonicalLocale } from "@nextcloud/l10n";
import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { IPhoto } from "../types";
// Memoize the result of short date conversions
@ -166,7 +167,8 @@ export const constants = {
/** Cache store */
let cacheStorage: Cache | null = null;
caches.open(`memories-${getCurrentUser()!.uid}`).then((cache) => { cacheStorage = cache });
const cacheName = `memories-${loadState('memories', 'version')}-${getCurrentUser()!.uid}`;
caches.open(cacheName).then((cache) => { cacheStorage = cache });
/** Get data from the cache */
export async function getCachedData(url: string) {