fix(config-profiles): show Git mount refresh progress
Disable duplicate refresh requests and show in-progress feedback while Git mount sources are refreshed.
This commit is contained in:
@@ -43,6 +43,7 @@ export const useConfigProfiles = () => {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [previewData, setPreviewData] = useState<ResolvedProfile | null>(null);
|
||||
const [previewingId, setPreviewingId] = useState<string | null>(null);
|
||||
const [isRefreshingGitMounts, setIsRefreshingGitMounts] = useState(false);
|
||||
const [formData, setFormData] =
|
||||
useState<CreateConfigProfileRequest>(defaultForm);
|
||||
const [includedProfileIds, setIncludedProfileIds] = useState<string[]>([]);
|
||||
@@ -275,7 +276,10 @@ export const useConfigProfiles = () => {
|
||||
};
|
||||
|
||||
const handleRefreshGitMounts = async (id: string): Promise<boolean> => {
|
||||
if (isRefreshingGitMounts) return false;
|
||||
|
||||
setError(null);
|
||||
setIsRefreshingGitMounts(true);
|
||||
try {
|
||||
const result = await refreshConfigProfileGitMounts(id);
|
||||
const refreshed = result.refresh_outcomes.filter(
|
||||
@@ -290,6 +294,8 @@ export const useConfigProfiles = () => {
|
||||
} catch (err) {
|
||||
setError(extractErrorMessage(err));
|
||||
return false;
|
||||
} finally {
|
||||
setIsRefreshingGitMounts(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -445,6 +451,7 @@ export const useConfigProfiles = () => {
|
||||
error,
|
||||
previewData,
|
||||
previewingId,
|
||||
isRefreshingGitMounts,
|
||||
formData,
|
||||
includedProfileIds,
|
||||
dragOverIndex,
|
||||
|
||||
Reference in New Issue
Block a user