Skip to content

Commit

Permalink
fixes kafbat#348
Browse files Browse the repository at this point in the history
  • Loading branch information
masonwoodford committed May 11, 2024
1 parent 359069b commit 6e724eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions frontend/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export const QUERY_REFETCH_OFF_OPTIONS = {
refetchIntervalInBackground: false,
};

export const QUERY_REFETCH_ON_WINDOW_FOCUS_OFF_OPTION = {
refetchOnWindowFocus: false,
};

// Cluster Form Constants
export const AUTH_OPTIONS = [
{ value: 'SASL/JAAS', label: 'SASL/JAAS' },
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/hooks/api/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
SCHEMA_QUERY_KEY,
SCHEMAS_VERSION_QUERY_KEY,
} from 'lib/queries';
import { QUERY_REFETCH_ON_WINDOW_FOCUS_OFF_OPTION } from 'lib/constants';
import {
CompatibilityLevel,
GetAllVersionsBySubjectRequest,
Expand All @@ -28,6 +29,7 @@ export function useGetLatestSchema(param: GetLatestSchemaRequest) {
param.subject,
],
queryFn: () => schemasApiClient.getLatestSchema(param),
...QUERY_REFETCH_ON_WINDOW_FOCUS_OFF_OPTION,
});
}

Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lib/hooks/api/topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
TopicFormDataRaw,
TopicFormFormattedParams,
} from 'lib/interfaces/topic';
import {QUERY_REFETCH_ON_WINDOW_FOCUS_OFF_OPTION} from "../../constants";

export const topicKeys = {
all: (clusterName: ClusterName) =>
Expand Down Expand Up @@ -50,10 +51,10 @@ export function useTopics(props: GetTopicsRequest) {
);
}
export function useTopicDetails(props: GetTopicDetailsRequest) {
return useQuery(topicKeys.details(props), () => api.getTopicDetails(props));
return useQuery(topicKeys.details(props), () => api.getTopicDetails(props), QUERY_REFETCH_ON_WINDOW_FOCUS_OFF_OPTION);
}
export function useTopicConfig(props: GetTopicDetailsRequest) {
return useQuery(topicKeys.config(props), () => api.getTopicConfigs(props));
return useQuery(topicKeys.config(props), () => api.getTopicConfigs(props), QUERY_REFETCH_ON_WINDOW_FOCUS_OFF_OPTION);
}
export function useTopicConsumerGroups(props: GetTopicDetailsRequest) {
return useQuery(topicKeys.consumerGroups(props), () =>
Expand Down

0 comments on commit 6e724eb

Please # to comment.