From dd61b714d82a517a51a421bdcb7e1fa683ff8624 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Mon, 7 Sep 2026 10:48:50 +0200 Subject: [PATCH] Don't serve plugin versions from a stale package cache --- .../dashboard/features/plugins/api/usePackageInfo.ts | 9 ++++----- src/apps/dashboard/features/plugins/api/usePackages.ts | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/apps/dashboard/features/plugins/api/usePackageInfo.ts b/src/apps/dashboard/features/plugins/api/usePackageInfo.ts index 726ab4a41d..2e8deb690b 100644 --- a/src/apps/dashboard/features/plugins/api/usePackageInfo.ts +++ b/src/apps/dashboard/features/plugins/api/usePackageInfo.ts @@ -8,17 +8,16 @@ import { useApi } from 'hooks/useApi'; import { QueryKey } from './queryKey'; import { queryClient } from 'utils/query/queryClient'; -import type { PackageInfo } from '@jellyfin/sdk/lib/generated-client/models/package-info'; +import { getPackagesQuery } from './usePackages'; const fetchPackageInfo = async ( api: Api, params: PluginApiGetPackageInfoRequest, options?: AxiosRequestConfig ) => { - const packagesData = queryClient.getQueryData([ QueryKey.Packages ]) as PackageInfo[]; - if (packagesData && params.assemblyGuid) { - // Use cached query to avoid re-fetching - const pkg = packagesData.find(v => v.guid === params.assemblyGuid); + if (params.assemblyGuid) { + const packages = await queryClient.fetchQuery(getPackagesQuery(api)); + const pkg = packages.find(v => v.guid === params.assemblyGuid); if (pkg) { return pkg; diff --git a/src/apps/dashboard/features/plugins/api/usePackages.ts b/src/apps/dashboard/features/plugins/api/usePackages.ts index 2b5d28c6b0..2b47c350ba 100644 --- a/src/apps/dashboard/features/plugins/api/usePackages.ts +++ b/src/apps/dashboard/features/plugins/api/usePackages.ts @@ -16,7 +16,7 @@ const fetchPackages = async ( return response.data; }; -const getPackagesQuery = ( +export const getPackagesQuery = ( api?: Api ) => queryOptions({ queryKey: [ QueryKey.Packages ],