Skip to content

Commit 2aaaf44

Browse files
Merge branch 'main' into fix-time-ago
2 parents 73bebdd + 8fc1c01 commit 2aaaf44

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
"Graphs": {
291291
"colorsProvider": "Provider",
292292
"colorsProviderConfig": "Provider Config",
293-
"colorizedTitle": "Colorized Graph by: ",
293+
"colorizedTitle": "Visualize: ",
294294
"loadingError": "Error loading graph data",
295295
"loadingGraph": "Loading graph data...",
296296
"noResources": "No resources to display"

src/lib/api/useApiResource.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext, useEffect, useState } from 'react';
1+
import { useContext, useEffect, useState, useRef } from 'react';
22
import useSWR, { SWRConfiguration, useSWRConfig } from 'swr';
33
import { fetchApiServerJson } from './fetch';
44
import { ApiConfigContext } from '../../components/Shared/k8s';
@@ -120,17 +120,19 @@ export const useProvidersConfigResource = (config?: SWRConfiguration) => {
120120
};
121121
const [configs, setConfigs] = useState<ProviderConfigs[]>([]);
122122
const [isLoading, setIsLoading] = useState(true);
123+
const initialLoaded = useRef(false);
123124

124125
useEffect(() => {
125126
const fetchDataAndUpdateState = async () => {
126-
setIsLoading(true);
127+
if (!initialLoaded.current) setIsLoading(true);
127128
try {
128129
await fetchProviderConfigsData();
129130
const finalData = await fetchProviderConfigs();
130131

131132
setConfigs(finalData);
132-
if (finalData.length > 0) {
133+
if (!initialLoaded.current) {
133134
setIsLoading(false);
135+
initialLoaded.current = true;
134136
}
135137
} catch (_) {
136138
setIsLoading(false);

0 commit comments

Comments
 (0)