mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Prevent "flicker" of tree while loading update
This commit is contained in:
@@ -25,7 +25,7 @@ export function fetchSources(
|
|||||||
if (initialLoad) {
|
if (initialLoad) {
|
||||||
dispatch(fetchSourcesPending(repository, revision, path));
|
dispatch(fetchSourcesPending(repository, revision, path));
|
||||||
} else {
|
} else {
|
||||||
dispatch(updateSourcesPending(repository, revision, path))
|
dispatch(updateSourcesPending(repository, revision, path, getSources(state, repository, revision, path)));
|
||||||
}
|
}
|
||||||
return apiClient
|
return apiClient
|
||||||
.get(createUrl(repository, revision, path))
|
.get(createUrl(repository, revision, path))
|
||||||
@@ -57,9 +57,10 @@ export function fetchSourcesPending(repository: Repository, revision: string, pa
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateSourcesPending(repository: Repository, revision: string, path: string): Action {
|
export function updateSourcesPending(repository: Repository, revision: string, path: string, currentSources: any): Action {
|
||||||
return {
|
return {
|
||||||
type: "UPDATE_PENDING",
|
type: "UPDATE_PENDING",
|
||||||
|
payload: { updatePending: true, sources: currentSources},
|
||||||
itemId: createItemId(repository, revision, path)
|
itemId: createItemId(repository, revision, path)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -94,16 +95,11 @@ export default function reducer(
|
|||||||
type: "UNKNOWN"
|
type: "UNKNOWN"
|
||||||
}
|
}
|
||||||
): any {
|
): any {
|
||||||
if (action.itemId && action.type === FETCH_SOURCES_SUCCESS) {
|
if (action.itemId && (action.type === FETCH_SOURCES_SUCCESS || action.type === "UPDATE_PENDING")) {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
[action.itemId]: action.payload
|
[action.itemId]: action.payload
|
||||||
};
|
};
|
||||||
} else if (action.itemId && action.type === "UPDATE_PENDING") {
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
[action.itemId]: { updatePending: true }}
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user