Skip to content

πŸ™Œ OpenHands: AI-Driven Development

hotfix: Don't handle git changes side effect too frequently (#8451)

sp.wack8d0e5c6c34c5
diff --git a/frontend/src/hooks/query/use-get-git-changes.ts b/frontend/src/hooks/query/use-get-git-changes.ts
index 1ae3819c40..a194340626 100644
--- a/frontend/src/hooks/query/use-get-git-changes.ts
+++ b/frontend/src/hooks/query/use-get-git-changes.ts
@@ -29,7 +29,7 @@ export const useGetGitChanges = () => {
// Latest changes should be on top
React.useEffect(() => {
- if (result.data) {
+ if (!result.isFetching && result.isSuccess && result.data) {
const currentData = result.data;
// If this is new data (not the same reference as before)
@@ -59,7 +59,7 @@ export const useGetGitChanges = () => {
}
}
}
- }, [result.data]);
+ }, [result.isFetching, result.isSuccess, result.data]);
return {
data: orderedChanges,
diff --git a/openhands/server/routes/files.py b/openhands/server/routes/files.py
index 9dd546cd5c..97800e7551 100644
--- a/openhands/server/routes/files.py
+++ b/openhands/server/routes/files.py
@@ -226,7 +226,7 @@ def zip_current_workspace(request: Request) -> FileResponse | JSONResponse:
@app.get(
'/git/changes',
- response_model=dict[str, Any],
+ response_model=list[dict[str, str]],
responses={
404: {'description': 'Not a git repository', 'model': dict},
500: {'description': 'Error getting changes', 'model': dict},
@@ -236,7 +236,7 @@ async def git_changes(
request: Request,
conversation_id: str,
user_id: str = Depends(get_user_id),
-) -> dict[str, Any] | JSONResponse:
+) -> list[dict[str, str]] | JSONResponse:
runtime: Runtime = request.state.conversation.runtime
conversation_store = await ConversationStoreImpl.get_instance(
config,