mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(k8s-services): avoid rerendering services table [r8s-387] (#832)
This commit is contained in:
parent
8d29b5ae71
commit
303047656e
9 changed files with 216 additions and 99 deletions
|
@ -23,18 +23,21 @@ export const queryKeys = {
|
|||
*
|
||||
* @returns The result of the query.
|
||||
*/
|
||||
export function useClusterServices(
|
||||
export function useClusterServices<T = Service[]>(
|
||||
environmentId: EnvironmentId,
|
||||
options?: { autoRefreshRate?: number; withApplications?: boolean }
|
||||
options?: {
|
||||
autoRefreshRate?: number;
|
||||
withApplications?: boolean;
|
||||
select?: (services: Service[]) => T;
|
||||
}
|
||||
) {
|
||||
return useQuery(
|
||||
queryKeys.clusterServices(environmentId),
|
||||
async () => getClusterServices(environmentId, options?.withApplications),
|
||||
{
|
||||
...withGlobalError('Unable to get services.'),
|
||||
refetchInterval() {
|
||||
return options?.autoRefreshRate ?? false;
|
||||
},
|
||||
refetchInterval: options?.autoRefreshRate,
|
||||
select: options?.select,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue