mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-10-26 16:45:18 +00:00
Merge pull request #8427 from Shadowghost/fix-stale-plugins
This commit is contained in:
2 files changed
+5
-6
No files matched your search
@@ -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;
|
||||
|
||||
@@ -16,7 +16,7 @@ const fetchPackages = async (
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getPackagesQuery = (
|
||||
export const getPackagesQuery = (
|
||||
api?: Api
|
||||
) => queryOptions({
|
||||
queryKey: [ QueryKey.Packages ],
|
||||
|
||||
Reference in new issue
Block a user