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
This commit is contained in:
schroda
2024-01-15 23:22:25 +01:00
committed by GitHub
parent bed586383f
commit 42e3d64f80
2 changed files with 8 additions and 1 deletions

View File

@@ -380,6 +380,10 @@ export class RequestManager {
this.cache.clearFor(...cacheKeys); this.cache.clearFor(...cacheKeys);
} }
public clearExtensionCache() {
this.cache.clearFor(this.cache.getKeyFor(EXTENSION_LIST_CACHE_KEY, undefined));
}
private createAbortController(): { signal: AbortSignal } & AbortableRequest { private createAbortController(): { signal: AbortSignal } & AbortableRequest {
const abortController = new AbortController(); const abortController = new AbortController();
const abortRequest = (reason?: any): void => { const abortRequest = (reason?: any): void => {

View File

@@ -144,7 +144,10 @@ export const ServerSettings = () => {
You as the user need to verify the security and that you trust any repository or extension. You as the user need to verify the security and that you trust any repository or extension.
</Trans> </Trans>
} }
handleChange={(repos) => updateSetting('extensionRepos', repos)} handleChange={(repos) => {
updateSetting('extensionRepos', repos);
requestManager.clearExtensionCache();
}}
values={serverSettings?.extensionRepos} values={serverSettings?.extensionRepos}
addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')} addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')}
placeholder="https://github.com/MY_ACCOUNT/MY_REPO/tree/repo" placeholder="https://github.com/MY_ACCOUNT/MY_REPO/tree/repo"