mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 17:59:14 +00:00
feat(releases): show indexer name in indexer filter (#1720)
* feat(releases): show indexer name instead of identifier in releases indexer filter * feat(releases): set correct types * refactor(releases): show indexer name instead of identifier in releases indexer filter * feat(releases): move listbox options back to render feat(releases): fallback to identifier instead of showing unknown
This commit is contained in:
parent
2681c2357d
commit
51265b6702
2 changed files with 18 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
|
||||
import { queryOptions } from "@tanstack/react-query";
|
||||
import { APIClient } from "@api/APIClient";
|
||||
import {
|
||||
ApiKeys,
|
||||
|
@ -133,8 +133,18 @@ export const ReleasesStatsQueryOptions = () =>
|
|||
export const ReleasesIndexersQueryOptions = () =>
|
||||
queryOptions({
|
||||
queryKey: ReleaseKeys.indexers(),
|
||||
queryFn: () => APIClient.release.indexerOptions(),
|
||||
placeholderData: keepPreviousData,
|
||||
queryFn: async () => {
|
||||
const indexersResponse: IndexerDefinition[] = await APIClient.indexers.getAll();
|
||||
const indexerOptionsResponse: string[] = await APIClient.release.indexerOptions();
|
||||
|
||||
const indexersMap = new Map(indexersResponse.map((indexer: IndexerDefinition) => [indexer.identifier, indexer.name]));
|
||||
|
||||
return indexerOptionsResponse.map((identifier: string) => ({
|
||||
name: indexersMap.get(identifier) || identifier,
|
||||
identifier: identifier
|
||||
}));
|
||||
},
|
||||
refetchOnWindowFocus: false,
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue