From 42e3d64f80fc5de93a464c758ecbb46d75bf9e61 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 15 Jan 2024 23:22:25 +0100 Subject: [PATCH] Clear extensions cache after extension repos change (#555) This will force a refetch of the extensions the next time the list gets opened which will update the extensions on the server --- src/lib/requests/RequestManager.ts | 4 ++++ src/screens/settings/ServerSettings.tsx | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index d9c06693..fe42f1de 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -380,6 +380,10 @@ export class RequestManager { this.cache.clearFor(...cacheKeys); } + public clearExtensionCache() { + this.cache.clearFor(this.cache.getKeyFor(EXTENSION_LIST_CACHE_KEY, undefined)); + } + private createAbortController(): { signal: AbortSignal } & AbortableRequest { const abortController = new AbortController(); const abortRequest = (reason?: any): void => { diff --git a/src/screens/settings/ServerSettings.tsx b/src/screens/settings/ServerSettings.tsx index fe694c12..88939225 100644 --- a/src/screens/settings/ServerSettings.tsx +++ b/src/screens/settings/ServerSettings.tsx @@ -144,7 +144,10 @@ export const ServerSettings = () => { You as the user need to verify the security and that you trust any repository or extension. } - handleChange={(repos) => updateSetting('extensionRepos', repos)} + handleChange={(repos) => { + updateSetting('extensionRepos', repos); + requestManager.clearExtensionCache(); + }} values={serverSettings?.extensionRepos} addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')} placeholder="https://github.com/MY_ACCOUNT/MY_REPO/tree/repo"