Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
"Graphs": {
"colorsProvider": "Provider",
"colorsProviderConfig": "Provider Config",
"colorizedTitle": "Colorized Graph by: ",
"colorizedTitle": "Visualize: ",
"loadingError": "Error loading graph data",
"loadingGraph": "Loading graph data...",
"noResources": "No resources to display"
Expand Down
8 changes: 5 additions & 3 deletions src/lib/api/useApiResource.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useEffect, useState } from 'react';
import { useContext, useEffect, useState, useRef } from 'react';
import useSWR, { SWRConfiguration, useSWRConfig } from 'swr';
import { fetchApiServerJson } from './fetch';
import { ApiConfigContext } from '../../components/Shared/k8s';
Expand Down Expand Up @@ -120,17 +120,19 @@ export const useProvidersConfigResource = (config?: SWRConfiguration) => {
};
const [configs, setConfigs] = useState<ProviderConfigs[]>([]);
const [isLoading, setIsLoading] = useState(true);
const initialLoaded = useRef(false);

useEffect(() => {
const fetchDataAndUpdateState = async () => {
setIsLoading(true);
if (!initialLoaded.current) setIsLoading(true);
try {
await fetchProviderConfigsData();
const finalData = await fetchProviderConfigs();

setConfigs(finalData);
if (finalData.length > 0) {
if (!initialLoaded.current) {
setIsLoading(false);
initialLoaded.current = true;
}
} catch (_) {
setIsLoading(false);
Expand Down
Loading